Issue
Current code is:
public static int hashCode(byte[] value) {
int h = 0;
byte[] var2 = value;
int var3 = value.length;
for(int var4 = 0; var4 < var3; ++var4) {
byte v = var2[var4];
h = 31 * h + (v & 255);
}
return h;
}
Possible code is:
public static int hashCode(byte[] value) {
int h = 0;
int var2 = value.length;
for(int var3 = 0; var3 < var2; ++var3) {
byte v = value[var3];
h = 31 * h + (v & 255);
}
return h;
}
In java.lang
package, there is a utility class called StringLatin1
. This class has hashCode
method which will be called from String
class's hashCode
method, if current string value is latin.
PS: I use Java 11.
Solution
Whatever current code you have posted is not the real code; it's the decompiled code which may vary from decompiler to decompiler and therefore you can not rely on it.
Answered By - Arvind Kumar Avinash
Answer Checked By - Timothy Miller (JavaFixing Admin)