public static String getRandomHexString ( int length ) { byte [ ] bytes = new byte [ length / 2 ] ; new Random ( ) . nextBytes ( bytes ) ; return DatatypeConverter . printHexBinary ( bytes ) ; }
Get a random hexadecimal string of a specified length .