@Test public void testBytesToBigInteger() { byte[] bigNumBytes = new byte[]{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; String bigNum = "8376419748709451303509889043802165155304723617084912823321731795381253826590747254992008184065"; byte[] smallNumBytes = new byte[]{1, 1, 1}; String smallNum = "65793"; assertTrue(new BigInteger(bigNum).compareTo(NumericUtil.bytesToBigInteger(bigNumBytes)) == 0); assertTrue(new BigInteger(smallNum).compareTo(NumericUtil.bytesToBigInteger(smallNumBytes)) == 0); }
public static BigInteger bytesToBigInteger(byte[] value, int offset, int length) { return bytesToBigInteger((Arrays.copyOfRange(value, offset, offset + length))); }
NumericUtil { public static BigInteger bytesToBigInteger(byte[] value, int offset, int length) { return bytesToBigInteger((Arrays.copyOfRange(value, offset, offset + length))); } }
NumericUtil { public static BigInteger bytesToBigInteger(byte[] value, int offset, int length) { return bytesToBigInteger((Arrays.copyOfRange(value, offset, offset + length))); }  }
NumericUtil { public static BigInteger bytesToBigInteger(byte[] value, int offset, int length) { return bytesToBigInteger((Arrays.copyOfRange(value, offset, offset + length))); }  static byte[] generateRandomBytes(int size); static boolean isValidHex(String value); static String cleanHexPrefix(String input); static String prependHexPrefix(String input); static BigInteger bytesToBigInteger(byte[] value, int offset, int length); static BigInteger bytesToBigInteger(byte[] value); static BigInteger hexToBigInteger(String hexValue); static String bigIntegerToHex(BigInteger value); static String bigIntegerToHexWithZeroPadded(BigInteger value, int size); static byte[] bigIntegerToBytesWithZeroPadded(BigInteger value, int length); static byte[] hexToBytes(String input); static byte[] hexToBytesLittleEndian(String input); static byte[] reverseBytes(byte[] bytes); static String bytesToHex(byte[] input); static String beBigEndianHex(String hex); static String beLittleEndianHex(String hex); static int bytesToInt(byte[] bytes); static byte[] intToBytes(int intValue); }
NumericUtil { public static BigInteger bytesToBigInteger(byte[] value, int offset, int length) { return bytesToBigInteger((Arrays.copyOfRange(value, offset, offset + length))); }  static byte[] generateRandomBytes(int size); static boolean isValidHex(String value); static String cleanHexPrefix(String input); static String prependHexPrefix(String input); static BigInteger bytesToBigInteger(byte[] value, int offset, int length); static BigInteger bytesToBigInteger(byte[] value); static BigInteger hexToBigInteger(String hexValue); static String bigIntegerToHex(BigInteger value); static String bigIntegerToHexWithZeroPadded(BigInteger value, int size); static byte[] bigIntegerToBytesWithZeroPadded(BigInteger value, int length); static byte[] hexToBytes(String input); static byte[] hexToBytesLittleEndian(String input); static byte[] reverseBytes(byte[] bytes); static String bytesToHex(byte[] input); static String beBigEndianHex(String hex); static String beLittleEndianHex(String hex); static int bytesToInt(byte[] bytes); static byte[] intToBytes(int intValue);  }