List of utility methods to do BigInteger Create
BigInteger | toBigInteger(final byte[] buffer, final int offset, final int length) to Big Integer return new BigInteger(Arrays.copyOfRange(buffer, offset, offset + length)); |
BigInteger | toBigInteger(final byte[] bytes) Converts a little endian byte array to a BigInteger. final byte[] bigEndianBytes = new byte[bytes.length + 1]; for (int i = 0; i < bytes.length; ++i) { bigEndianBytes[i + 1] = bytes[bytes.length - i - 1]; return new BigInteger(bigEndianBytes); |
BigInteger | toBigInteger(final Integer i) Null save convert of a Integer to a BigInteger . if (i != null) { return BigInteger.valueOf(i); } else { return null; |
BigInteger | toBigInteger(int arg) to Big Integer return new BigInteger(Integer.toString(arg)); |
BigInteger | toBigInteger(int[] x, int bitsPerDigit) to Big Integer final int digitsPerLong = (59 / bitsPerDigit) + 1; BigInteger c = BigInteger.ZERO; for (int i = 0; i < x.length;) { long a = 0; for (int j = 0; i < x.length && j < digitsPerLong; j++) { a |= ((long) x[i] << (bitsPerDigit * j)); i++; c = c.add(BigInteger.valueOf(a).shiftLeft(bitsPerDigit * digitsPerLong * ((i - 1) / digitsPerLong))); return c; |
List | toBigInteger(List to Big Integer List<BigInteger> bigIntegerVector = null; if (integerVector != null) { bigIntegerVector = new ArrayList<BigInteger>(); for (Integer i : integerVector) { bigIntegerVector.add(BigInteger.valueOf(i)); return bigIntegerVector; ... |
BigInteger | toBigInteger(long value) to Big Integer return new BigInteger(String.valueOf(value)); |
BigInteger | toBigInteger(Object o) to Big Integer if (o instanceof Integer) { return BigInteger.valueOf(((Integer) o).intValue()); } else if (o instanceof BigInteger) { return (BigInteger) o; } else if (o instanceof Double) { return null; } else { throw new IllegalArgumentException(); ... |
BigInteger | toBigInteger(Object value) Convert an Object to a BigInteger. if (value == null) return null; if (value instanceof BigInteger) return (BigInteger) value; if (value instanceof String) { if ("".equals((String) value)) return null; return new BigInteger((String) value); ... |
BigInteger | toBigInteger(UUID uuid) to Big Integer return new BigInteger(1, toByteArray(uuid)); |