Here you can find the source of printBitFormat(int number)
public static void printBitFormat(int number)
//package com.java2s; //License from project: Apache License public class Main { private static final int INT_SIZE = 32; public static void printBitFormat(int number) { for (int idx = INT_SIZE - 1; idx >= 0; --idx) { if ((number & (1 << idx)) == 0) { System.out.print("0"); } else { System.out.print("1"); }/*from w w w . j a v a 2 s . c o m*/ } System.out.println(); } }