code: final int compareHalf(MutableBigInteger b) {
          int blen = b.intLen;
          int len = intLen;
          if (len <= 0)
              return blen <= 0 ? 0 : -1;
          if (len > blen)
              return 1;
          if (len < blen - 1)
              return -1;
          int[] bval = b.value;
          int bstart = 0;
          int carry = 0;
          // Only 2 cases left:len == blen or len == blen - 1
          if (len != blen) { // len == blen - 1
              if (bval[bstart] == 1) {
                  ++bstart;
                  carry = 0x80000000;
              } else
                  return -1;
          }
          // compare values with right-shifted values of b,
          // carrying shifted-out bits across words
          int[] val = value;
          for (int i = offset, j = bstart; i < len + offset;) {
              int bv = bval[j++];
              long hb = ((bv >>> 1) + carry) & LONG_MASK;
              long v = val[i++] & LONG_MASK;
              if (v != hb)
                  return v < hb ? -1 : 1;
              carry = (bv & 1) << 31; // carray will be either 0x80000000 or 0
          }
          return carry == 0 ? 0 : -1;
      }
docs: Compare this against half of a MutableBigInteger object (Needed for
  remainder tests).
  Assumes no leading unnecessary zeros, which holds for results
  from divide().