@Test public void bin2long() { assertEquals(1000L, Util.bin2long(thousandlong, 0)); }
public static long bin2long(byte[] array, int offset) { return ((array[offset + 0] & 0xffL) << 56) + ((array[offset + 1] & 0xffL) << 48) + ((array[offset + 2] & 0xffL) << 40) + ((array[offset + 3] & 0xffL) << 32) + ((array[offset + 4] & 0xffL) << 24) + ((array[offset + 5] & 0xffL) << 16) + ((array[offset + 6] & 0xffL) << 8) + (array[offset + 7] & 0xffL); }
Util { public static long bin2long(byte[] array, int offset) { return ((array[offset + 0] & 0xffL) << 56) + ((array[offset + 1] & 0xffL) << 48) + ((array[offset + 2] & 0xffL) << 40) + ((array[offset + 3] & 0xffL) << 32) + ((array[offset + 4] & 0xffL) << 24) + ((array[offset + 5] & 0xffL) << 16) + ((array[offset + 6] & 0xffL) << 8) + (array[offset + 7] & 0xffL); } }
Util { public static long bin2long(byte[] array, int offset) { return ((array[offset + 0] & 0xffL) << 56) + ((array[offset + 1] & 0xffL) << 48) + ((array[offset + 2] & 0xffL) << 40) + ((array[offset + 3] & 0xffL) << 32) + ((array[offset + 4] & 0xffL) << 24) + ((array[offset + 5] & 0xffL) << 16) + ((array[offset + 6] & 0xffL) << 8) + (array[offset + 7] & 0xffL); } private  Util(); }
Util { public static long bin2long(byte[] array, int offset) { return ((array[offset + 0] & 0xffL) << 56) + ((array[offset + 1] & 0xffL) << 48) + ((array[offset + 2] & 0xffL) << 40) + ((array[offset + 3] & 0xffL) << 32) + ((array[offset + 4] & 0xffL) << 24) + ((array[offset + 5] & 0xffL) << 16) + ((array[offset + 6] & 0xffL) << 8) + (array[offset + 7] & 0xffL); } private  Util(); static void int2bin(byte[] out, int offset, int i); static byte[] int2bin(int i); static void long2bin(byte[] out, int offset, long i); static byte[] long2bin(long i); static byte[] double2bin(double d); static void double2bin(byte[] out, int offset, double d); static byte[] boolean2bin(boolean b); static void boolean2bin(byte[] out, int offset, boolean b); static int bin2int(byte[] array, int offset); static long bin2long(byte[] array, int offset); static long bin2long(byte[] array); static double bin2double(byte[] array, int offset); static double bin2double(byte[] array); static boolean bin2boolean(byte[] array, int offset); static boolean bin2boolean(byte[] array); static byte[] twosComplimentToPositiveInt(byte[] input); static byte[] positiveIntToTwosCompliment(byte[] input); static BigInteger byteToBigInt(byte[] input); static byte[] bigIntToByte(BigInteger input); static byte[] joinBytes(byte[]... bytes); static List<byte[]> splitBytes(byte[] bytes); static byte[][] listByte2Array(List<byte[]> bytes); static int compareByteArrays(byte[] first, byte[] second); static void checkPassword(final String password); static void checkUsername(final String username); static boolean deleteDir(File dir); static void addFrom(Throwable t, Throwable from); static byte[] hashKey(byte[] publicKey); }
Util { public static long bin2long(byte[] array, int offset) { return ((array[offset + 0] & 0xffL) << 56) + ((array[offset + 1] & 0xffL) << 48) + ((array[offset + 2] & 0xffL) << 40) + ((array[offset + 3] & 0xffL) << 32) + ((array[offset + 4] & 0xffL) << 24) + ((array[offset + 5] & 0xffL) << 16) + ((array[offset + 6] & 0xffL) << 8) + (array[offset + 7] & 0xffL); } private  Util(); static void int2bin(byte[] out, int offset, int i); static byte[] int2bin(int i); static void long2bin(byte[] out, int offset, long i); static byte[] long2bin(long i); static byte[] double2bin(double d); static void double2bin(byte[] out, int offset, double d); static byte[] boolean2bin(boolean b); static void boolean2bin(byte[] out, int offset, boolean b); static int bin2int(byte[] array, int offset); static long bin2long(byte[] array, int offset); static long bin2long(byte[] array); static double bin2double(byte[] array, int offset); static double bin2double(byte[] array); static boolean bin2boolean(byte[] array, int offset); static boolean bin2boolean(byte[] array); static byte[] twosComplimentToPositiveInt(byte[] input); static byte[] positiveIntToTwosCompliment(byte[] input); static BigInteger byteToBigInt(byte[] input); static byte[] bigIntToByte(BigInteger input); static byte[] joinBytes(byte[]... bytes); static List<byte[]> splitBytes(byte[] bytes); static byte[][] listByte2Array(List<byte[]> bytes); static int compareByteArrays(byte[] first, byte[] second); static void checkPassword(final String password); static void checkUsername(final String username); static boolean deleteDir(File dir); static void addFrom(Throwable t, Throwable from); static byte[] hashKey(byte[] publicKey); static final int INT; static final int LONG; static final int DOUBLE; static final int BOOLEAN; }