@Test public void testPadToLong() { assertEquals(0x0000000099999999L, NumericUtils.padToLong(byteArrayWithNum(4, 0x99))); assertEquals(0x0000999999999999L, NumericUtils.padToLong(byteArrayWithNum(6, 0x99))); assertEquals(0x9999999999999999L, NumericUtils.padToLong(byteArrayWithNum(8, 0x99))); assertEquals(0x1111111111111111L, NumericUtils.padToLong(byteArrayWithNum(8, 0x11))); assertEquals(0x0000000011111111L, NumericUtils.padToLong(byteArrayWithNum(4, 0x11))); assertEquals(0x0000181818181818L, NumericUtils.padToLong(byteArrayWithNum(6, 0x18))); }
public static long padToLong(byte[] bytes) { long retVal = (bytes[0] & 0xFF); for (int i = 1; i < Math.min(bytes.length, 8); i++) { retVal |= (bytes[i] & 0xFFL) << (i * 8); } return retVal; }
NumericUtils { public static long padToLong(byte[] bytes) { long retVal = (bytes[0] & 0xFF); for (int i = 1; i < Math.min(bytes.length, 8); i++) { retVal |= (bytes[i] & 0xFFL) << (i * 8); } return retVal; } }
NumericUtils { public static long padToLong(byte[] bytes) { long retVal = (bytes[0] & 0xFF); for (int i = 1; i < Math.min(bytes.length, 8); i++) { retVal |= (bytes[i] & 0xFFL) << (i * 8); } return retVal; }  }
NumericUtils { public static long padToLong(byte[] bytes) { long retVal = (bytes[0] & 0xFF); for (int i = 1; i < Math.min(bytes.length, 8); i++) { retVal |= (bytes[i] & 0xFFL) << (i * 8); } return retVal; }  static String humanReadableByteCount(double bytes); static long getMessageDigestHash(final String algorithmName, final String string); static long asLong(byte[] bytes); static long padToLong(byte[] bytes); }
NumericUtils { public static long padToLong(byte[] bytes) { long retVal = (bytes[0] & 0xFF); for (int i = 1; i < Math.min(bytes.length, 8); i++) { retVal |= (bytes[i] & 0xFFL) << (i * 8); } return retVal; }  static String humanReadableByteCount(double bytes); static long getMessageDigestHash(final String algorithmName, final String string); static long asLong(byte[] bytes); static long padToLong(byte[] bytes);  }