/ Published in: Java
in Java an int is 4 bytes (32 bits)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
int[] getIntBytesFromInt(int base) { int[] nums = new int[4]; nums[0] = base & 0x000000FF; nums[1] = (base>>>8) & 0x000000FF; nums[2] = (base>>>16) & 0x000000FF; nums[3] = (base>>>24) & 0x000000FF; return nums; }