src/main/java/com/groupon/uuid/UUID.java
public static boolean isValidUUID(char[] ch) {
        return  ch != null       &&
                ch.length == 36  &&
                validHex(ch[0 ]) &&
                validHex(ch[1 ]) &&
                validHex(ch[2 ]) &&
                validHex(ch[3 ]) &&
                validHex(ch[4 ]) &&
                validHex(ch[5 ]) &&
                validHex(ch[6 ]) &&
                validHex(ch[7 ]) &&
                ch[8] == '-'     &&
                validHex(ch[9 ]) &&
                validHex(ch[10]) &&
                validHex(ch[11]) &&
                validHex(ch[12]) &&
                ch[13] == '-'    &&
                validHex(ch[14]) &&
                validHex(ch[15]) &&
                validHex(ch[16]) &&
                validHex(ch[17]) &&
                ch[18] == '-'    &&
                validHex(ch[19]) &&
                validHex(ch[20]) &&
                validHex(ch[21]) &&
                validHex(ch[22]) &&
                ch[23] == '-'    &&
                validHex(ch[24]) &&
                validHex(ch[25]) &&
                validHex(ch[26]) &&
                validHex(ch[27]) &&
                validHex(ch[28]) &&
                validHex(ch[29]) &&
                validHex(ch[30]) &&
                validHex(ch[31]) &&
                validHex(ch[32]) &&
                validHex(ch[33]) &&
                validHex(ch[34]) &&
                validHex(ch[35]);
    }
public static boolean isValidUUID(char[] ch) {
        return  ch != null       &&
                ch.length == 36  &&
                validHex(ch[0 ]) &&
                validHex(ch[1 ]) &&
                validHex(ch[2 ]) &&
                validHex(ch[3 ]) &&
                validHex(ch[4 ]) &&
                validHex(ch[5 ]) &&
                validHex(ch[6 ]) &&
                validHex(ch[7 ]) &&
                ch[8] == '-'     &&
                validHex(ch[9 ]) &&
                validHex(ch[10]) &&
                validHex(ch[11]) &&
                validHex(ch[12]) &&
                ch[13] == '-'    &&
                validHex(ch[14]) &&
                validHex(ch[15]) &&
                validHex(ch[16]) &&
                validHex(ch[17]) &&
                ch[18] == '-'    &&
                validHex(ch[19]) &&
                validHex(ch[20]) &&
                validHex(ch[21]) &&
                validHex(ch[22]) &&
                ch[23] == '-'    &&
                validHex(ch[24]) &&
                validHex(ch[25]) &&
                validHex(ch[26]) &&
                validHex(ch[27]) &&
                validHex(ch[28]) &&
                validHex(ch[29]) &&
                validHex(ch[30]) &&
                validHex(ch[31]) &&
                validHex(ch[32]) &&
                validHex(ch[33]) &&
                validHex(ch[34]) &&
                validHex(ch[35]);
    }
public static boolean isValidUUID ( char [ ] ch ) { return ch != null && ch . length == 36 && validHex ( ch [ 0 ] ) && validHex ( ch [ 1 ] ) && validHex ( ch [ 2 ] ) && validHex ( ch [ 3 ] ) && validHex ( ch [ 4 ] ) && validHex ( ch [ 5 ] ) && validHex ( ch [ 6 ] ) && validHex ( ch [ 7 ] ) && ch [ 8 ] == ' ' && validHex ( ch [ 9 ] ) && validHex ( ch [ 10 ] ) && validHex ( ch [ 11 ] ) && validHex ( ch [ 12 ] ) && ch [ 13 ] == ' ' && validHex ( ch [ 14 ] ) && validHex ( ch [ 15 ] ) && validHex ( ch [ 16 ] ) && validHex ( ch [ 17 ] ) && ch [ 18 ] == ' ' && validHex ( ch [ 19 ] ) && validHex ( ch [ 20 ] ) && validHex ( ch [ 21 ] ) && validHex ( ch [ 22 ] ) && ch [ 23 ] == ' ' && validHex ( ch [ 24 ] ) && validHex ( ch [ 25 ] ) && validHex ( ch [ 26 ] ) && validHex ( ch [ 27 ] ) && validHex ( ch [ 28 ] ) && validHex ( ch [ 29 ] ) && validHex ( ch [ 30 ] ) && validHex ( ch [ 31 ] ) && validHex ( ch [ 32 ] ) && validHex ( ch [ 33 ] ) && validHex ( ch [ 34 ] ) && validHex ( ch [ 35 ] ) ; }
This method validates a character array as the expected format for a printed representation of a UUID. The
expected format is 36 characters long, with '-' at the 8th, 13th, 18th, and 23rd characters. The remaining
characters are expected to be valid hex, meaning in the range ('0' - '9', 'a' - 'f', 'A' - 'F') inclusive.
If a character array is valid, then it can be used to construct a UUID. This method has been written unrolled
and verbosely, with the theory that this is simpler and faster than using loops or a regex.
@param ch A character array of a UUID's printed representation.
@return True or false based on whether the UUID is valid, no exceptions are thrown.
This method validates a character array as the expected format for a printed representation of a UUID . The expected format is 36 characters long with - at the 8th 13th 18th and 23rd characters . The remaining characters are expected to be valid hex meaning in the range ( 0 - 9 a - f A - F ) inclusive . If a character array is valid then it can be used to construct a UUID . This method has been written unrolled and verbosely with the theory that this is simpler and faster than using loops or a regex .