class Main { public static void main(String[] args) { int x = 10; int count = 0; String str=""; while (x != 0) { int z = x; x = x & (x - 1); z = Integer.toBinaryString(z - x).length()-1; str=str+z; count++; } System.out.println(str); } }