protected String codeName(int ch) { if (ch < 0) return "end of file"; else return "0x" + Integer.toHexString(ch & 0xff) + " (" + (char) +ch + ")"; }
protected String codeName(int ch) { if (ch < 0) return "end of file"; else return "0x" + Integer.toHexString(ch & 0xff) + " (" + (char) +ch + ")"; }
protected String codeName(int ch) { if (ch < 0) return "end of file"; else return "0x" + Integer.toHexString(ch & 0xff); }
private String getString(int strId) { if (0 <= strId && strId < strings.length) { return strings[strId]; } return "NOT_FOUND_STR_0x" + Integer.toHexString(strId); }
/** * Return a hex String form of an object's identity hash code. * @param obj the object * @return the object's identity code in hex notation */ public static String getIdentityHexString(Object obj) { return Integer.toHexString(System.identityHashCode(obj)); }
/** * Creates a new group with a generated name and the provided {@link EventExecutor} to notify the * {@link ChannelGroupFuture}s. {@code stayClosed} defines whether or not, this group can be closed * more than once. Adding channels to a closed group will immediately close them, too. This makes it * easy, to shutdown server and child channels at once. */ public DefaultChannelGroup(EventExecutor executor, boolean stayClosed) { this("group-0x" + Integer.toHexString(nextId.incrementAndGet()), executor, stayClosed); }
/** Returns the color encoded as hex string with the format RRGGBBAA. */ public String toString () { String value = Integer .toHexString(((int)(255 * r) << 24) | ((int)(255 * g) << 16) | ((int)(255 * b) << 8) | ((int)(255 * a))); while (value.length() < 8) value = "0" + value; return value; }
/** * Build an identification String for the given {@link DataSource}, * primarily for logging purposes. * @param dataSource the {@code DataSource} to introspect * @return the identification String */ private String identify(DataSource dataSource) { return dataSource.getClass().getName() + '@' + Integer.toHexString(dataSource.hashCode()); }
private void throwException(String error, int expected, int actual) throws IOException { throw new IOException(error + ", expected: 0x" + Integer.toHexString(expected) + ", actual: 0x" + Integer.toHexString(actual) + ", offset: 0x" + Long.toHexString(getPos())); }
private static @Nullable String convertDottedQuadToHex(String ipString) { int lastColon = ipString.lastIndexOf(':'); String initialPart = ipString.substring(0, lastColon + 1); String dottedQuad = ipString.substring(lastColon + 1); byte[] quad = textToNumericFormatV4(dottedQuad); if (quad == null) { return null; } String penultimate = Integer.toHexString(((quad[0] & 0xff) << 8) | (quad[1] & 0xff)); String ultimate = Integer.toHexString(((quad[2] & 0xff) << 8) | (quad[3] & 0xff)); return initialPart + penultimate + ":" + ultimate; }
private static String lenientToString(@Nullable Object o) { try { return String.valueOf(o); } catch (Exception e) { // Default toString() behavior - see Object.toString() String objectToString = o.getClass().getName() + '@' + Integer.toHexString(System.identityHashCode(o)); // Logger is created inline with fixed name to avoid forcing Proguard to create another class. Logger.getLogger("com.google.common.base.Strings") .log(WARNING, "Exception during lenientFormat for " + objectToString, e); return "<" + objectToString + " threw " + e.getClass().getName() + ">"; } } }
@Override public String toString() { return "AccessInfo: " + type + " 0x" + Integer.toHexString(accFlags) + " (" + rawString() + ")"; } }
int decode(char ch) throws DecodingException { if (ch > Ascii.MAX) { throw new DecodingException("Unrecognized character: 0x" + Integer.toHexString(ch)); } int result = decodabet[ch]; if (result == -1) { if (ch <= 0x20 || ch == Ascii.MAX) { throw new DecodingException("Unrecognized character: 0x" + Integer.toHexString(ch)); } else { throw new DecodingException("Unrecognized character: " + ch); } } return result; }
private String prepareNamePart(String name) { if (name.length() > maxLength) { return "x" + Integer.toHexString(name.hashCode()); } if (!NameMapper.isAllCharsPrintable(name)) { return removeInvalidChars(name); } return name; }
private void checkError () { int error = 0; if ((error = gl.getError()) != GL_NO_ERROR) { throw new GdxRuntimeException("GL error: " + error + ", " + Integer.toHexString(error)); } }
@Test public void parseNumberAsHex() { String aByte = "0x" + Integer.toHexString(Byte.valueOf(Byte.MAX_VALUE).intValue()); String aShort = "0x" + Integer.toHexString(Short.valueOf(Short.MAX_VALUE).intValue()); String anInteger = "0x" + Integer.toHexString(Integer.MAX_VALUE); String aLong = "0x" + Long.toHexString(Long.MAX_VALUE); String aReallyBigInt = "FEBD4E677898DFEBFFEE44"; assertByteEquals(aByte); assertShortEquals(aShort); assertIntegerEquals(anInteger); assertLongEquals(aLong); assertEquals("BigInteger did not parse", new BigInteger(aReallyBigInt, 16), NumberUtils.parseNumber("0x" + aReallyBigInt, BigInteger.class)); }
private void readMessageFrame() throws IOException { int opcode = this.opcode; if (opcode != OPCODE_TEXT && opcode != OPCODE_BINARY) { throw new ProtocolException("Unknown opcode: " + toHexString(opcode)); } readMessage(); if (opcode == OPCODE_TEXT) { frameCallback.onReadMessage(messageFrameBuffer.readUtf8()); } else { frameCallback.onReadMessage(messageFrameBuffer.readByteString()); } }
@Test public void testCustomNumberEditorWithHex() { CustomNumberEditor editor = new CustomNumberEditor(Integer.class, false); editor.setAsText("0x" + Integer.toHexString(64)); assertEquals(new Integer(64), editor.getValue()); }
public void testWhitespaceBreakingWhitespaceSubset() throws Exception { for (int c = 0; c <= Character.MAX_VALUE; c++) { if (breakingWhitespace().matches((char) c)) { assertTrue(Integer.toHexString(c), whitespace().matches((char) c)); } } }
public void check() { assertEquals(null, test("n", null)); assertEquals("n=7", test("n", "7")); assertEquals("n=77", test("n", "0x" + Integer.toHexString(77))); assertEquals("Failed to parse number", test("n", "abc")); assertEquals("Failed to parse number", test("n", "0xabX")); } }