@Test public void testByteToHex() throws Exception { try { HoodUtil.byteToHex(null); fail(); } catch (NullPointerException ignored) { } assertEquals("", HoodUtil.byteToHex(new byte[0]).toLowerCase()); assertEquals("e5", HoodUtil.byteToHex(new byte[]{-27}).toLowerCase()); assertEquals("cfac", HoodUtil.byteToHex(new byte[]{-49, -84}).toLowerCase()); assertEquals("88fd8c", HoodUtil.byteToHex(new byte[]{-120, -3, -116}).toLowerCase()); assertEquals("2516c585", HoodUtil.byteToHex(new byte[]{37, 22, -59, -123}).toLowerCase()); assertEquals("01a1bc1e65", HoodUtil.byteToHex(new byte[]{1, -95, -68, 30, 101}).toLowerCase()); assertEquals("b8cc92ee1711", HoodUtil.byteToHex(new byte[]{-72, -52, -110, -18, 23, 17}).toLowerCase()); assertEquals("5fc1e2958c699d", HoodUtil.byteToHex(new byte[]{95, -63, -30, -107, -116, 105, -99}).toLowerCase()); assertEquals("f9373f5de142dfec", HoodUtil.byteToHex(new byte[]{-7, 55, 63, 93, -31, 66, -33, -20}).toLowerCase()); assertEquals("f3fd69c164245a7ff0", HoodUtil.byteToHex(new byte[]{-13, -3, 105, -63, 100, 36, 90, 127, -16}).toLowerCase()); assertNotSame("eefd19c164245a72f1", HoodUtil.byteToHex(new byte[]{-13, -3, 105, -63, 100, 36, 90, 127, -16}).toLowerCase()); }
public static String byteToHex(byte[] bytes) { char[] hexChars = new char[bytes.length * 2]; for (int j = 0; j < bytes.length; j++) { int v = bytes[j] & 0xFF; hexChars[j * 2] = hexArray[v >>> 4]; hexChars[j * 2 + 1] = hexArray[v & 0x0F]; } return new String(hexChars).toLowerCase(); }
HoodUtil { public static String byteToHex(byte[] bytes) { char[] hexChars = new char[bytes.length * 2]; for (int j = 0; j < bytes.length; j++) { int v = bytes[j] & 0xFF; hexChars[j * 2] = hexArray[v >>> 4]; hexChars[j * 2 + 1] = hexArray[v & 0x0F]; } return new String(hexChars).toLowerCase(); } }
HoodUtil { public static String byteToHex(byte[] bytes) { char[] hexChars = new char[bytes.length * 2]; for (int j = 0; j < bytes.length; j++) { int v = bytes[j] & 0xFF; hexChars[j * 2] = hexArray[v >>> 4]; hexChars[j * 2 + 1] = hexArray[v & 0x0F]; } return new String(hexChars).toLowerCase(); } private  HoodUtil(); }
HoodUtil { public static String byteToHex(byte[] bytes) { char[] hexChars = new char[bytes.length * 2]; for (int j = 0; j < bytes.length; j++) { int v = bytes[j] & 0xFF; hexChars[j * 2] = hexArray[v >>> 4]; hexChars[j * 2 + 1] = hexArray[v & 0x0F]; } return new String(hexChars).toLowerCase(); } private  HoodUtil(); static String byteToHex(byte[] bytes); static T getConditionally(T object, boolean shouldReturnEntry); static Locale getCurrentLocale(Context ctx); static String humanReadableByteCount(long bytes, boolean si); static String millisToDaysHoursMinString(long millis); static String toSimpleDateTimeFormat(long millisEpochUtc); static String obfuscateAndShorten(@Nullable String original, int maxCharLengthLeftOrRight,
                                             char obfuscationChar); }
HoodUtil { public static String byteToHex(byte[] bytes) { char[] hexChars = new char[bytes.length * 2]; for (int j = 0; j < bytes.length; j++) { int v = bytes[j] & 0xFF; hexChars[j * 2] = hexArray[v >>> 4]; hexChars[j * 2 + 1] = hexArray[v & 0x0F]; } return new String(hexChars).toLowerCase(); } private  HoodUtil(); static String byteToHex(byte[] bytes); static T getConditionally(T object, boolean shouldReturnEntry); static Locale getCurrentLocale(Context ctx); static String humanReadableByteCount(long bytes, boolean si); static String millisToDaysHoursMinString(long millis); static String toSimpleDateTimeFormat(long millisEpochUtc); static String obfuscateAndShorten(@Nullable String original, int maxCharLengthLeftOrRight,
                                             char obfuscationChar);  }