Your method signature says you will return a String
public static String shortUUID()
but you are actually returning an int
, since that's the return type of the hashCode()
method
return uuid.toString().hashCode();
Just change your method sig to:
public static int shortUUID()
EDIT - to answer comment
There is no getInt()
method on the UUID
class, so uuid.getInt().hashCode()
won't compile. If you want to simplify your return statement, you can just hashCode()
directly on uuid like this:
return uuid.hashCode();