Here you can find the source of bits(int value, int c)
public final static String bits(int value, int c)
//package com.java2s; /** //from w w w .ja va 2 s .co m * Copyright (c) 2003-2007 Stewart Allen <stewart@neuron.com>. All rights reserved. * This program is free software. See the 'License' file for details. */ public class Main { public final static String bits(int value, int c) { StringBuffer sb = new StringBuffer(); for (int i = c - 1; i >= 0; i--) { int bv = (value >>> (8 * i)) & 0xff; sb.append('['); for (int j = 7; j >= 0; j--) { sb.append((bv & (1 << j)) > 0 ? '1' : '0'); } sb.append(']'); } return sb.toString(); } }