修复可能得负数问题

This commit is contained in:
wangshilong 2024-11-29 11:08:38 +08:00
parent 2f33c62e6e
commit 1ad169440d
1 changed files with 1 additions and 1 deletions

View File

@ -23,7 +23,7 @@ public class HexUtil {
}
public static int hashPartition(String key, int partition) {
return key.hashCode() % partition;
return Math.abs(key.hashCode() % partition);
}
public static void main(String[] args) {