java.math.BigInteger.setBigInt()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(140)

本文整理了Java中java.math.BigInteger.setBigInt()方法的一些代码示例,展示了BigInteger.setBigInt()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BigInteger.setBigInt()方法的具体详情如下:
包路径:java.math.BigInteger
类名称:BigInteger
方法名:setBigInt

BigInteger.setBigInt介绍

暂无

代码示例

代码示例来源:origin: robovm/robovm

BigInteger(BigInt bigInt) {
  if (bigInt == null || bigInt.getNativeBIGNUM() == 0) {
    throw new AssertionError();
  }
  setBigInt(bigInt);
}

代码示例来源:origin: robovm/robovm

/**
 * 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);
}

代码示例来源:origin: robovm/robovm

BigInteger(int sign, long value) {
  BigInt bigInt = new BigInt();
  bigInt.putULongInt(value, (sign < 0));
  setBigInt(bigInt);
}

代码示例来源:origin: robovm/robovm

/**
 * 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);
}

代码示例来源:origin: robovm/robovm

/**
 * 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);
}

代码示例来源:origin: robovm/robovm

/**
 * 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);
}

代码示例来源:origin: robovm/robovm

/**
 * 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;
  }
}

代码示例来源:origin: robovm/robovm

BigInt prime = new BigInt();
  prime.putULongInt(candidate, false);
  setBigInt(prime);
} else {
    setBigInt(BigInt.generatePrimeDefault(bitLength));
  } while (bitLength() != bitLength);

代码示例来源:origin: robovm/robovm

BigInt bigInt = new BigInt();
  bigInt.putDecString(value);
  setBigInt(bigInt);
} else if (radix == 16) {
  BigInt bigInt = new BigInt();
  bigInt.putHexString(value);
  setBigInt(bigInt);
} else {
  if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX) {

代码示例来源:origin: MobiVM/robovm

BigInteger(BigInt bigInt) {
  if (bigInt == null || bigInt.getNativeBIGNUM() == 0) {
    throw new AssertionError();
  }
  setBigInt(bigInt);
}

代码示例来源:origin: ibinti/bugvm

BigInteger(BigInt bigInt) {
  if (bigInt == null || bigInt.getNativeBIGNUM() == 0) {
    throw new AssertionError();
  }
  setBigInt(bigInt);
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * 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);
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * 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);
}

代码示例来源:origin: MobiVM/robovm

/**
 * 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);
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * 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);
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * 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);
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

BigInteger(int sign, long value) {
  BigInt bigInt = new BigInt();
  bigInt.putULongInt(value, (sign < 0));
  setBigInt(bigInt);
}

代码示例来源:origin: MobiVM/robovm

BigInteger(int sign, long value) {
  BigInt bigInt = new BigInt();
  bigInt.putULongInt(value, (sign < 0));
  setBigInt(bigInt);
}

代码示例来源:origin: com.bugvm/bugvm-rt

BigInteger(int sign, long value) {
  BigInt bigInt = new BigInt();
  bigInt.putULongInt(value, (sign < 0));
  setBigInt(bigInt);
}

代码示例来源:origin: ibinti/bugvm

BigInteger(int sign, long value) {
  BigInt bigInt = new BigInt();
  bigInt.putULongInt(value, (sign < 0));
  setBigInt(bigInt);
}

相关文章

微信公众号

最新文章

更多