private static boolean isPrime(int bits) {
    if ((bits & 1) == 0 || bits % 3 == 0) {
      return false;
    }
    int sqrt = (int)Math.sqrt(bits);
    for (int i = 6; i <= sqrt; i += 6) {
      if (bits % (i - 1) == 0 || bits % (i + 1) == 0) {
        return false;
      }
    }
    return true;
  }
private static boolean isPrime(int bits)