throw new ArithmeticException("BigInteger: Divide by zero");
int[] c; int shift = bitLength(0, x) - bitLength(0, y);  if (shift > 1) { c = shiftLeft(y, shift - 1); } else { c = new int[x.length];  System.arraycopy(y, 0, c, c.length - y.length, y.length); }  subtract(0, x, 0, c);  int xStart = 0; int cStart = 0;  for (; ; ) { int cmp = compareTo(xStart, x, cStart, c);  while (cmp >= 0) { subtract(xStart, x, cStart, c); cmp = compareTo(xStart, x, cStart, c); }  xyCmp = compareTo(xStart, x, 0, y);  if (xyCmp > 0) { if (x[xStart] == 0) { xStart++; }  shift = bitLength(cStart, c) - bitLength(xStart, x);  if (shift == 0) { c = shiftRightOne(cStart, c); } else { c = shiftRight(cStart, c, shift); }  if (c[cStart] == 0) { cStart++; } } else if (xyCmp == 0) { for (int i = xStart; i != x.length; i++) { x[i] = 0; } break; } else { break; } } } else if (xyCmp == 0) { for (int i = 0; i != x.length; i++) { x[i] = 0; }
    public BigInteger remainder(BigInteger val) throws ArithmeticException    {        if (val.sign == 0)        {            throw new ArithmeticException("BigInteger: Divide by zero");        }        if (sign == 0)        {            return BigInteger.ZERO;        }        int[] res = new int[this.magnitude.length];        System.arraycopy(this.magnitude, 0, res, 0, res.length);        return new BigInteger(sign, remainder(res, val.magnitude));    }