code: public static String getRandomHexString(int length){
          byte[] bytes = new byte[length/2];
          new Random().nextBytes(bytes);
          return DatatypeConverter.printHexBinary(bytes);
      }
docs: Get a random hexadecimal string of a specified length.
  @param length length of the string to produce
  @return a random string consisting only of hexadecimal characters