Commons Lang、BitField#getRawValue(), #getValue()
import org.apache.commons.lang.BitField; public class C2009042500 { public static void main(String[] args) { BitField bf; bf = new BitField(5); System.out.println(bf.getRawValue(15) + " " + bf.getValue(15)); bf = new BitField(4); System.out.println(bf.getRawValue(15) + " " + bf.getValue(15)); } }
で、
5 5 4 1