/** * Hashes a string for a URI hash. Handles octets. * * @param hash the input hash * @param s the string to hash and combine with the input hash * @return the resulting hash */ public static int hash(int hash, String s) { if (s == null) { return hash; } // similar to Arrays.hashCode return s.indexOf('%') < 0 ? 31 * hash + s.hashCode() : normalizedHash(hash, s); }