Here you can find the source of decode(int bits)
public static Integer[] decode(int bits)
//package com.java2s; //License from project: Open Source License public class Main { public static Integer[] decode(int bits) { int count = 0; Integer[] buff = new Integer[32]; for (int i = 0; i < buff.length; i++) { if ((bits & (1 << i)) > 0) { buff[count++] = i;//from ww w . jav a 2s . co m } } Integer[] result = new Integer[count]; System.arraycopy(buff, 0, result, 0, count); return result; } }