Here you can find the source of intToBits(int n, int size)
public static int[] intToBits(int n, int size)
//package com.java2s; //License from project: Open Source License public class Main { public static int[] intToBits(int n, int size) { int[] bits = new int[size]; for (int i = 0; i < size; i++) { bits[i] = (n / (int) Math.pow(2, i)) % 2; }/* ww w. j a v a 2 s. c o m*/ return bits; } }