public class MyClass {
public static void main(String args[]) {
int x = 981;
System.out.println(String.format("%16s", Integer.toBinaryString(x)).replaceAll(" ", "0"));
x = ~x;
System.out.println(String.format("%16s", Integer.toBinaryString(x)).replaceAll(" ", "0"));
}
}
/*
run:
0000001111010101
11111111111111111111110000101010
*/