static int remainder(long dividend, int divisor) {
    dividend = dividend % divisor;
    return (int)(dividend < 0 ? dividend + divisor : dividend);
  }
static int remainder(long dividend, int divisor)