int i = 0x000000FF;
i = i << 24;
message = String.format("0x%08X", i);
// prints the message 0xFF000000
int i = 0x000000FF;
i = i << 32;
message = String.format("0x%08X", i);
// prints the m
我正在尋找存儲4個無符號值,一個布爾(或整數),兩個整數與最大(包括)64和一個整數,可以存儲至少100,000。成一個單一的散列。 使用信息我發現here 我可以編碼和解碼2之間 - 與255的最大整數的4像這樣 static int encode(int a, int b, int c, int d) {
return a & 0xff | (b << 8) | (c << 16)