@Test
public void testHashCodeAscii() {

    for (int i = 0; i < 1000; ++i) {
        // byte[] and char[] need to be initialized such that there values are within valid "ascii" range
        byte[] bytes = new byte[i];
        char[] bytesChar = new char[i];
        for (int j = 0; j < bytesChar.length; ++j) {
            bytesChar[j] = randomCharInByteRange();
            bytes[j] = (byte) (bytesChar[j] & 0xff);
        }
        String string = new String(bytesChar);
        assertEquals("length=" + i,
                     hashCodeAsciiSafe(bytes, 0, bytes.length),
                     hashCodeAscii(bytes, 0, bytes.length));
        assertEquals("length=" + i,
                hashCodeAscii(bytes, 0, bytes.length),
                hashCodeAscii(string));
    }
}