* @param modulus
   * @return int
   */
  public static int integer_mod(int x, int modulus) {
    { int remainder = (x % modulus);

      if (remainder > 0) {
        if (modulus < 0) {
          remainder = modulus + remainder;
        }
      }
      else if (remainder < 0) {
        if (modulus > 0) {
          remainder = modulus + remainder;
        }
      }
      return (remainder);
    }
  }