修复可能得负数问题
This commit is contained in:
parent
2f33c62e6e
commit
1ad169440d
|
@ -23,7 +23,7 @@ public class HexUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int hashPartition(String key, int partition) {
|
public static int hashPartition(String key, int partition) {
|
||||||
return key.hashCode() % partition;
|
return Math.abs(key.hashCode() % partition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
Loading…
Reference in New Issue