BigInteger(BigInt bigInt) { if (bigInt == null || bigInt.getNativeBIGNUM() == 0) { throw new AssertionError(); } setBigInt(bigInt); }
/** * Assigns all transient fields upon deserialization of a {@code BigInteger} * instance. */ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); BigInt bigInt = new BigInt(); bigInt.putBigEndian(magnitude, signum < 0); setBigInt(bigInt); }
BigInteger(int sign, long value) { BigInt bigInt = new BigInt(); bigInt.putULongInt(value, (sign < 0)); setBigInt(bigInt); }
/** * Constructs a new {@code BigInteger} from the given two's complement * representation. The most significant byte is the entry at index 0. The * most significant bit of this entry determines the sign of the new {@code * BigInteger} instance. The array must be nonempty. * * @param value two's complement representation of the new {@code * BigInteger}. * @throws NullPointerException if {@code value == null}. * @throws NumberFormatException if the length of {@code value} is zero. */ public BigInteger(byte[] value) { if (value.length == 0) { throw new NumberFormatException("value.length == 0"); } BigInt bigInt = new BigInt(); bigInt.putBigEndianTwosComplement(value); setBigInt(bigInt); }
/** * Constructs a new {@code BigInteger} by parsing {@code value}. The string * representation consists of an optional plus or minus sign followed by a * non-empty sequence of decimal digits. Digits are interpreted as if by * {@code Character.digit(char,10)}. * * @param value string representation of the new {@code BigInteger}. * @throws NullPointerException if {@code value == null}. * @throws NumberFormatException if {@code value} is not a valid * representation of a {@code BigInteger}. */ public BigInteger(String value) { BigInt bigInt = new BigInt(); bigInt.putDecString(value); setBigInt(bigInt); }
/** * Constructs a new {@code BigInteger} instance with the given sign and * magnitude. * * @param signum sign of the new {@code BigInteger} (-1 for negative, 0 for * zero, 1 for positive). * @param magnitude magnitude of the new {@code BigInteger} with the most * significant byte first. * @throws NullPointerException if {@code magnitude == null}. * @throws NumberFormatException if the sign is not one of -1, 0, 1 or if * the sign is zero and the magnitude contains non-zero entries. */ public BigInteger(int signum, byte[] magnitude) { if (magnitude == null) { throw new NullPointerException("magnitude == null"); } if (signum < -1 || signum > 1) { throw new NumberFormatException("Invalid signum: " + signum); } if (signum == 0) { for (byte element : magnitude) { if (element != 0) { throw new NumberFormatException("signum-magnitude mismatch"); } } } BigInt bigInt = new BigInt(); bigInt.putBigEndian(magnitude, signum < 0); setBigInt(bigInt); }
/** * Returns the internal native representation of this big integer, computing * it if necessary. */ BigInt getBigInt() { if (nativeIsValid) { return bigInt; } synchronized (this) { if (nativeIsValid) { return bigInt; } BigInt bigInt = new BigInt(); bigInt.putLittleEndianInts(digits, (sign < 0)); setBigInt(bigInt); return bigInt; } }
BigInteger(BigInt bigInt) { if (bigInt == null || bigInt.getNativeBIGNUM() == 0) { throw new AssertionError(); } setBigInt(bigInt); }
BigInteger(BigInt bigInt) { if (bigInt == null || bigInt.getNativeBIGNUM() == 0) { throw new AssertionError(); } setBigInt(bigInt); }
/** * Assigns all transient fields upon deserialization of a {@code BigInteger} * instance. */ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); BigInt bigInt = new BigInt(); bigInt.putBigEndian(magnitude, signum < 0); setBigInt(bigInt); }
/** * Assigns all transient fields upon deserialization of a {@code BigInteger} * instance. */ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); BigInt bigInt = new BigInt(); bigInt.putBigEndian(magnitude, signum < 0); setBigInt(bigInt); }
/** * Assigns all transient fields upon deserialization of a {@code BigInteger} * instance. */ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); BigInt bigInt = new BigInt(); bigInt.putBigEndian(magnitude, signum < 0); setBigInt(bigInt); }
/** * Assigns all transient fields upon deserialization of a {@code BigInteger} * instance. */ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); BigInt bigInt = new BigInt(); bigInt.putBigEndian(magnitude, signum < 0); setBigInt(bigInt); }
/** * Assigns all transient fields upon deserialization of a {@code BigInteger} * instance. */ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); BigInt bigInt = new BigInt(); bigInt.putBigEndian(magnitude, signum < 0); setBigInt(bigInt); }
BigInteger(int sign, long value) { BigInt bigInt = new BigInt(); bigInt.putULongInt(value, (sign < 0)); setBigInt(bigInt); }
BigInteger(int sign, long value) { BigInt bigInt = new BigInt(); bigInt.putULongInt(value, (sign < 0)); setBigInt(bigInt); }
BigInteger(int sign, long value) { BigInt bigInt = new BigInt(); bigInt.putULongInt(value, (sign < 0)); setBigInt(bigInt); }
BigInteger(int sign, long value) { BigInt bigInt = new BigInt(); bigInt.putULongInt(value, (sign < 0)); setBigInt(bigInt); }