### Question:
Identifiers { public static String makeIdFromHash(long d) { StringBuffer result = new StringBuffer(); if (d<0) d=-d; if (d<0) d=-(d+1000); result.append(ID_VALID_START_CHARS.charAt((int)(d % (26+26)))); d /= (26+26); while (d!=0) { result.append(ID_VALID_NONSTART_CHARS.charAt((int)(d%(26+26+10)))); d /= (26+26+10); } return result.toString(); }  static String makeRandomId(int l); static String makeRandomPassword(final int length); static String makeRandomPassword(final int length, String... passwordValidCharsPool); static String makeIdFromHash(long d); static String makeRandomJavaId(int l); static double randomDouble(); static long randomLong(); static boolean randomBoolean(); static int randomInt(); static int randomInt(int upbound); static byte[] randomBytes(byte[] buf); static byte[] randomBytes(int length); static String makeRandomBase64Id(int length); static String getBase64IdFromValue(long value); static String getBase64IdFromValue(long value, int length); static void appendBase64IdFromValueOfLength(long value, int length, StringBuffer sb); static void appendBase64IdFromValueOfLength(long value, int length, StringBuilder sb); static boolean isValidToken(String token, String validStartChars, String validSubsequentChars); static final String UPPER_CASE_ALPHA; static final String LOWER_CASE_ALPHA; static final String NUMERIC; static final String NON_ALPHA_NUMERIC; static final String JAVA_GOOD_START_CHARS; static final String JAVA_GOOD_NONSTART_CHARS; static final String JAVA_GOOD_SEGMENT_REGEX; static final String JAVA_GOOD_PACKAGE_OR_CLASS_REGEX; static final String JAVA_GOOD_BINARY_REGEX; static final String JAVA_GENERATED_IDENTIFIER_START_CHARS; static final String JAVA_GENERATED_IDENTIFIERNONSTART_CHARS; static final String BASE64_VALID_CHARS; static final String ID_VALID_START_CHARS; static final String ID_VALID_NONSTART_CHARS; static final String PASSWORD_VALID_CHARS; }### Answer:
@Test public void testFromHash() { String id1 = Identifiers.makeIdFromHash("Hello".hashCode()); Assert.assertTrue(!Strings.isBlank(id1)); String id2 = Identifiers.makeIdFromHash("hello".hashCode()); String id3 = Identifiers.makeIdFromHash("hello".hashCode()); Assert.assertEquals(id2, id3); Assert.assertNotEquals(id1, id2); Assert.assertEquals(Identifiers.makeIdFromHash(0), "A"); String idLong = Identifiers.makeIdFromHash(Long.MAX_VALUE); log.info("ID's made from hash, of 'hello' is "+id1+" and of Long.MAX_VALUE is "+idLong); Assert.assertTrue(idLong.length() > id1.length()); }
@Test public void testFromNegativeHash() { String id1 = Identifiers.makeIdFromHash(-1); Assert.assertTrue(!Strings.isBlank(id1)); log.info("ID's made from hash, of -1 is "+id1+" and of Long.MIN_VALUE is "+Identifiers.makeIdFromHash(Long.MIN_VALUE)); }