Commons Lang、BitField#setBoolean()
import org.apache.commons.lang.BitField; public class C2009043000 { public static void main(String[] args) { BitField bf; bf = new BitField(5); System.out.println(bf.setBoolean(1, true)); bf = new BitField(5); System.out.println(bf.setBoolean(2, true)); bf = new BitField(5); System.out.println(bf.setBoolean(3, false)); bf = new BitField(5); System.out.println(bf.setBoolean(2, false)); bf = new BitField(0x50); System.out.println(bf.setBoolean(0x30, false)); } }
で、
5 7 2 2 32