code: public static String generateDigitsString(int length) {
          StringBuffer buf = new StringBuffer(length);
          SecureRandom rand = new SecureRandom();
          for (int i = 0; i < length; i++) {
              buf.append(rand.nextInt(digits.length));
          }
          return buf.toString();
      }
docs: Generates random string that contains digits only.
  
  @param length the length of the generated string
  @return random string