Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.HashMap;
- public class Main {
- public static void main(String[] args) {
- int bitmap=0xA3490208;
- String binStr = Integer.toBinaryString(bitmap);
- int size = 0;
- for (int i = 1; i <= binStr.length(); i++) {
- if (binStr.charAt(i - 1) == '0') {
- continue;
- }
- if (i == 1) {
- size += 16;
- } else if (i == 2) {
- size += 6;
- } else if(i == 3) {
- size += 12;
- } else if (4 <= i && i <= 11) {
- size += 8;
- } else if (12 <= i && i <= 32) {
- size += 4;
- }
- }//*/
- System.out.println(size+" bytes");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement