本文整理了Java中java.math.BigInteger.setJavaRepresentation()
方法的一些代码示例,展示了BigInteger.setJavaRepresentation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BigInteger.setJavaRepresentation()
方法的具体详情如下:
包路径:java.math.BigInteger
类名称:BigInteger
方法名:setJavaRepresentation
暂无
代码示例来源:origin: robovm/robovm
/**
* Constructs a number without creating new space. This construct should be
* used only if the three fields of representation are known.
*
* @param sign the sign of the number.
* @param numberLength the length of the internal array.
* @param digits a reference of some array created before.
*/
BigInteger(int sign, int numberLength, int[] digits) {
setJavaRepresentation(sign, numberLength, digits);
}
代码示例来源:origin: robovm/robovm
/**
* Constructs a random non-negative {@code BigInteger} instance in the range
* {@code [0, pow(2, numBits)-1]}.
*
* @param numBits maximum length of the new {@code BigInteger} in bits.
* @param random is the random number generator to be used.
* @throws IllegalArgumentException if {@code numBits} < 0.
*/
public BigInteger(int numBits, Random random) {
if (numBits < 0) {
throw new IllegalArgumentException("numBits < 0: " + numBits);
}
if (numBits == 0) {
setJavaRepresentation(0, 1, new int[] { 0 });
} else {
int sign = 1;
int numberLength = (numBits + 31) >> 5;
int[] digits = new int[numberLength];
for (int i = 0; i < numberLength; i++) {
digits[i] = random.nextInt();
}
// Clear any extra bits.
digits[numberLength - 1] >>>= (-numBits) & 31;
setJavaRepresentation(sign, numberLength, digits);
}
javaIsValid = true;
}
代码示例来源:origin: robovm/robovm
void prepareJavaRepresentation() {
if (javaIsValid) {
return;
}
synchronized (this) {
if (javaIsValid) {
return;
}
int sign = bigInt.sign();
int[] digits = (sign != 0) ? bigInt.littleEndianIntsMagnitude() : new int[] { 0 };
setJavaRepresentation(sign, digits.length, digits);
}
}
代码示例来源:origin: robovm/robovm
bi.setJavaRepresentation(sign, numberLength, digits);
代码示例来源:origin: ibinti/bugvm
/**
* Constructs a number without creating new space. This construct should be
* used only if the three fields of representation are known.
*
* @param sign the sign of the number.
* @param numberLength the length of the internal array.
* @param digits a reference of some array created before.
*/
BigInteger(int sign, int numberLength, int[] digits) {
setJavaRepresentation(sign, numberLength, digits);
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
/**
* Constructs a number without creating new space. This construct should be
* used only if the three fields of representation are known.
*
* @param sign the sign of the number.
* @param numberLength the length of the internal array.
* @param digits a reference of some array created before.
*/
BigInteger(int sign, int numberLength, int[] digits) {
setJavaRepresentation(sign, numberLength, digits);
}
代码示例来源:origin: com.gluonhq/robovm-rt
/**
* Constructs a number without creating new space. This construct should be
* used only if the three fields of representation are known.
*
* @param sign the sign of the number.
* @param numberLength the length of the internal array.
* @param digits a reference of some array created before.
*/
BigInteger(int sign, int numberLength, int[] digits) {
setJavaRepresentation(sign, numberLength, digits);
}
代码示例来源:origin: com.bugvm/bugvm-rt
/**
* Constructs a number without creating new space. This construct should be
* used only if the three fields of representation are known.
*
* @param sign the sign of the number.
* @param numberLength the length of the internal array.
* @param digits a reference of some array created before.
*/
BigInteger(int sign, int numberLength, int[] digits) {
setJavaRepresentation(sign, numberLength, digits);
}
代码示例来源:origin: MobiVM/robovm
/**
* Constructs a number without creating new space. This construct should be
* used only if the three fields of representation are known.
*
* @param sign the sign of the number.
* @param numberLength the length of the internal array.
* @param digits a reference of some array created before.
*/
BigInteger(int sign, int numberLength, int[] digits) {
setJavaRepresentation(sign, numberLength, digits);
}
代码示例来源:origin: FlexoVM/flexovm
/**
* Constructs a number without creating new space. This construct should be
* used only if the three fields of representation are known.
*
* @param sign the sign of the number.
* @param numberLength the length of the internal array.
* @param digits a reference of some array created before.
*/
BigInteger(int sign, int numberLength, int[] digits) {
setJavaRepresentation(sign, numberLength, digits);
}
代码示例来源:origin: ibinti/bugvm
/**
* Constructs a random non-negative {@code BigInteger} instance in the range
* {@code [0, pow(2, numBits)-1]}.
*
* @param numBits maximum length of the new {@code BigInteger} in bits.
* @param random is the random number generator to be used.
* @throws IllegalArgumentException if {@code numBits} < 0.
*/
public BigInteger(int numBits, Random random) {
if (numBits < 0) {
throw new IllegalArgumentException("numBits < 0: " + numBits);
}
if (numBits == 0) {
setJavaRepresentation(0, 1, new int[] { 0 });
} else {
int sign = 1;
int numberLength = (numBits + 31) >> 5;
int[] digits = new int[numberLength];
for (int i = 0; i < numberLength; i++) {
digits[i] = random.nextInt();
}
// Clear any extra bits.
digits[numberLength - 1] >>>= (-numBits) & 31;
setJavaRepresentation(sign, numberLength, digits);
}
javaIsValid = true;
}
代码示例来源:origin: MobiVM/robovm
/**
* Constructs a random non-negative {@code BigInteger} instance in the range
* {@code [0, pow(2, numBits)-1]}.
*
* @param numBits maximum length of the new {@code BigInteger} in bits.
* @param random is the random number generator to be used.
* @throws IllegalArgumentException if {@code numBits} < 0.
*/
public BigInteger(int numBits, Random random) {
if (numBits < 0) {
throw new IllegalArgumentException("numBits < 0: " + numBits);
}
if (numBits == 0) {
setJavaRepresentation(0, 1, new int[] { 0 });
} else {
int sign = 1;
int numberLength = (numBits + 31) >> 5;
int[] digits = new int[numberLength];
for (int i = 0; i < numberLength; i++) {
digits[i] = random.nextInt();
}
// Clear any extra bits.
digits[numberLength - 1] >>>= (-numBits) & 31;
setJavaRepresentation(sign, numberLength, digits);
}
javaIsValid = true;
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
/**
* Constructs a random non-negative {@code BigInteger} instance in the range
* {@code [0, pow(2, numBits)-1]}.
*
* @param numBits maximum length of the new {@code BigInteger} in bits.
* @param random is the random number generator to be used.
* @throws IllegalArgumentException if {@code numBits} < 0.
*/
public BigInteger(int numBits, Random random) {
if (numBits < 0) {
throw new IllegalArgumentException("numBits < 0: " + numBits);
}
if (numBits == 0) {
setJavaRepresentation(0, 1, new int[] { 0 });
} else {
int sign = 1;
int numberLength = (numBits + 31) >> 5;
int[] digits = new int[numberLength];
for (int i = 0; i < numberLength; i++) {
digits[i] = random.nextInt();
}
// Clear any extra bits.
digits[numberLength - 1] >>>= (-numBits) & 31;
setJavaRepresentation(sign, numberLength, digits);
}
javaIsValid = true;
}
代码示例来源:origin: com.bugvm/bugvm-rt
/**
* Constructs a random non-negative {@code BigInteger} instance in the range
* {@code [0, pow(2, numBits)-1]}.
*
* @param numBits maximum length of the new {@code BigInteger} in bits.
* @param random is the random number generator to be used.
* @throws IllegalArgumentException if {@code numBits} < 0.
*/
public BigInteger(int numBits, Random random) {
if (numBits < 0) {
throw new IllegalArgumentException("numBits < 0: " + numBits);
}
if (numBits == 0) {
setJavaRepresentation(0, 1, new int[] { 0 });
} else {
int sign = 1;
int numberLength = (numBits + 31) >> 5;
int[] digits = new int[numberLength];
for (int i = 0; i < numberLength; i++) {
digits[i] = random.nextInt();
}
// Clear any extra bits.
digits[numberLength - 1] >>>= (-numBits) & 31;
setJavaRepresentation(sign, numberLength, digits);
}
javaIsValid = true;
}
代码示例来源:origin: MobiVM/robovm
void prepareJavaRepresentation() {
if (javaIsValid) {
return;
}
synchronized (this) {
if (javaIsValid) {
return;
}
int sign = bigInt.sign();
int[] digits = (sign != 0) ? bigInt.littleEndianIntsMagnitude() : new int[] { 0 };
setJavaRepresentation(sign, digits.length, digits);
}
}
代码示例来源:origin: ibinti/bugvm
void prepareJavaRepresentation() {
if (javaIsValid) {
return;
}
synchronized (this) {
if (javaIsValid) {
return;
}
int sign = bigInt.sign();
int[] digits = (sign != 0) ? bigInt.littleEndianIntsMagnitude() : new int[] { 0 };
setJavaRepresentation(sign, digits.length, digits);
}
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
void prepareJavaRepresentation() {
if (javaIsValid) {
return;
}
synchronized (this) {
if (javaIsValid) {
return;
}
int sign = bigInt.sign();
int[] digits = (sign != 0) ? bigInt.littleEndianIntsMagnitude() : new int[] { 0 };
setJavaRepresentation(sign, digits.length, digits);
}
}
代码示例来源:origin: com.gluonhq/robovm-rt
void prepareJavaRepresentation() {
if (javaIsValid) {
return;
}
synchronized (this) {
if (javaIsValid) {
return;
}
int sign = bigInt.sign();
int[] digits = (sign != 0) ? bigInt.littleEndianIntsMagnitude() : new int[] { 0 };
setJavaRepresentation(sign, digits.length, digits);
}
}
代码示例来源:origin: FlexoVM/flexovm
void prepareJavaRepresentation() {
if (javaIsValid) {
return;
}
synchronized (this) {
if (javaIsValid) {
return;
}
int sign = bigInt.sign();
int[] digits = (sign != 0) ? bigInt.littleEndianIntsMagnitude() : new int[] { 0 };
setJavaRepresentation(sign, digits.length, digits);
}
}
代码示例来源:origin: com.bugvm/bugvm-rt
void prepareJavaRepresentation() {
if (javaIsValid) {
return;
}
synchronized (this) {
if (javaIsValid) {
return;
}
int sign = bigInt.sign();
int[] digits = (sign != 0) ? bigInt.littleEndianIntsMagnitude() : new int[] { 0 };
setJavaRepresentation(sign, digits.length, digits);
}
}
内容来源于网络,如有侵权,请联系作者删除!