Here you can find the source of intToBinary(int i)
private static char[] intToBinary(int i)
//package com.java2s; //License from project: Apache License public class Main { private static char[] intToBinary(int i) { char[] values = new char[32]; for (int pos = 31; pos >= 0; pos--, i >>= 1) { if ((i & (int) 0x01) == (int) 1) values[pos] = '1'; else//from ww w . ja va2s.co m values[pos] = '0'; } return values; } }