@@ -93,9 +93,20 @@ public static BigInteger fromByteArray(byte[] bytes, boolean littleEndian) {
9393
9494 /**
9595 * Initializes an arbitrary-precision integer from an array of bytes.
96- * @param bytes A byte array.
97- * @param littleEndian A Boolean object.
98- * @return An arbitrary-precision integer.
96+ * @param bytes A byte array consisting of the two's-complement integer
97+ * representation of the arbitrary-precision integer to create. The last
98+ * byte contains the lowest 8-bits, the next-to-last contains the next
99+ * lowest 8 bits, and so on. To encode negative numbers, take the
100+ * absolute value of the number, subtract by 1, encode the number into
101+ * bytes, XOR each byte, and if the most-significant bit of the first
102+ * byte isn't set, add an additional byte at the start with the value
103+ * 255. For little-endian, the byte order is reversed from the byte
104+ * order just discussed.
105+ * @param littleEndian If true, the byte order is little-endian, or
106+ * least-significant-byte first. If false, the byte order is big-endian,
107+ * or most-significant-byte first.
108+ * @return An arbitrary-precision integer. Returns 0 if the byte array's length
109+ * is 0.
99110 * @throws java.lang.NullPointerException The parameter {@code bytes} is null.
100111 */
101112 public static BigInteger fromBytes (byte [] bytes , boolean littleEndian ) {
@@ -173,7 +184,7 @@ public static BigInteger fromRadixSubstring(
173184 * format.
174185 */
175186 public static BigInteger fromString (String str ) {
176- return new BigInteger (EInteger .fromString (str ));
187+ return new BigInteger (EInteger .FromString (str ));
177188}
178189
179190 /**
@@ -243,7 +254,7 @@ public BigInteger add(BigInteger bigintAugend) {
243254 * object's value is 0 or negative 1.
244255 */
245256 public int bitLength () {
246- return this .getEi ().bitLength ();
257+ return this .getEi ().GetSignedBitLength ();
247258 }
248259
249260 /**
@@ -326,7 +337,7 @@ public BigInteger gcd(BigInteger bigintSecond) {
326337 if (bigintSecond == null ) {
327338 throw new NullPointerException ("bigintSecond" );
328339}
329- return new BigInteger (this .getEi ().gcd (bigintSecond .getEi ()));
340+ return new BigInteger (this .getEi ().Gcd (bigintSecond .getEi ()));
330341}
331342
332343 /**
@@ -335,7 +346,7 @@ public BigInteger gcd(BigInteger bigintSecond) {
335346 * 0.
336347 */
337348 public int getDigitCount () {
338- return this .getEi ().getDigitCount ();
349+ return this .getEi ().GetDigitCount ();
339350 }
340351
341352 /**
@@ -353,7 +364,7 @@ public int getDigitCount() {
353364 * if this value is 0.).
354365 */
355366 public int getLowBit () {
356- return this .getEi ().getLowBit ( );
367+ return ( this .isZero ()) ? ( 0 ) : ( this . getEi ().GetLowBit () );
357368 }
358369
359370 /**
@@ -460,7 +471,7 @@ public BigInteger mod(BigInteger divisor) {
460471 if (divisor == null ) {
461472 throw new NullPointerException ("divisor" );
462473}
463- return new BigInteger (this .getEi ().mod (divisor .getEi ()));
474+ return new BigInteger (this .getEi ().Mod (divisor .getEi ()));
464475}
465476
466477 /**
@@ -513,7 +524,7 @@ public BigInteger negate() {
513524 * than 0.
514525 */
515526 public BigInteger pow (int powerSmall ) {
516- return new BigInteger (this .getEi ().pow (powerSmall ));
527+ return new BigInteger (this .getEi ().Pow (powerSmall ));
517528}
518529
519530 /**
@@ -619,7 +630,7 @@ public BigInteger subtract(BigInteger subtrahend) {
619630 * object's value; otherwise, false.
620631 */
621632 public boolean testBit (int index ) {
622- return this .getEi ().testBit (index );
633+ return this .getEi ().GetSignedBit (index );
623634}
624635
625636 /**
0 commit comments