@Test public void long2bin() { assertArrayEquals(thousandlong, Util.long2bin(1000)); byte[] out = new byte[8]; Util.long2bin(out, 0, 1000); assertArrayEquals(thousandlong, out); }
public static void long2bin(byte[] out, int offset, long i) { out[offset + 0] = (byte) (i >> 56); out[offset + 1] = (byte) (i >> 48 & 0xff); out[offset + 2] = (byte) (i >> 40 & 0xff); out[offset + 3] = (byte) (i >> 32 & 0xff); out[offset + 4] = (byte) (i >> 24 & 0xff); out[offset + 5] = (byte) (i >> 16 & 0xff); out[offset + 6] = (byte) (i >> 8 & 0xff); out[offset + 7] = (byte) (i & 0xff); }
Util { public static void long2bin(byte[] out, int offset, long i) { out[offset + 0] = (byte) (i >> 56); out[offset + 1] = (byte) (i >> 48 & 0xff); out[offset + 2] = (byte) (i >> 40 & 0xff); out[offset + 3] = (byte) (i >> 32 & 0xff); out[offset + 4] = (byte) (i >> 24 & 0xff); out[offset + 5] = (byte) (i >> 16 & 0xff); out[offset + 6] = (byte) (i >> 8 & 0xff); out[offset + 7] = (byte) (i & 0xff); } }
Util { public static void long2bin(byte[] out, int offset, long i) { out[offset + 0] = (byte) (i >> 56); out[offset + 1] = (byte) (i >> 48 & 0xff); out[offset + 2] = (byte) (i >> 40 & 0xff); out[offset + 3] = (byte) (i >> 32 & 0xff); out[offset + 4] = (byte) (i >> 24 & 0xff); out[offset + 5] = (byte) (i >> 16 & 0xff); out[offset + 6] = (byte) (i >> 8 & 0xff); out[offset + 7] = (byte) (i & 0xff); } private  Util(); }
Util { public static void long2bin(byte[] out, int offset, long i) { out[offset + 0] = (byte) (i >> 56); out[offset + 1] = (byte) (i >> 48 & 0xff); out[offset + 2] = (byte) (i >> 40 & 0xff); out[offset + 3] = (byte) (i >> 32 & 0xff); out[offset + 4] = (byte) (i >> 24 & 0xff); out[offset + 5] = (byte) (i >> 16 & 0xff); out[offset + 6] = (byte) (i >> 8 & 0xff); out[offset + 7] = (byte) (i & 0xff); } 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 void long2bin(byte[] out, int offset, long i) { out[offset + 0] = (byte) (i >> 56); out[offset + 1] = (byte) (i >> 48 & 0xff); out[offset + 2] = (byte) (i >> 40 & 0xff); out[offset + 3] = (byte) (i >> 32 & 0xff); out[offset + 4] = (byte) (i >> 24 & 0xff); out[offset + 5] = (byte) (i >> 16 & 0xff); out[offset + 6] = (byte) (i >> 8 & 0xff); out[offset + 7] = (byte) (i & 0xff); } 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; }