code: public static BigInteger generateRandomPrimeGreaterThan(BigInteger num) {
          BigInteger res = BigInteger.ZERO;
          while (res.compareTo(num) <= 0) {
              res = BigInteger.probablePrime(num.bitLength(), RANDOM);
          }
          return res;
      }
docs: Generate random probable prime guaranteed to be greater than the number specified.
  
  @param num lower bound for the generated probable prime
  @return random probable prime greater than the specified number