28 lines
532 B
Java
28 lines
532 B
Java
public class It_Test{
|
|
|
|
static int i = 1;
|
|
|
|
public static int iterator(){
|
|
i = i * 2;
|
|
return i;
|
|
}
|
|
|
|
static void printBinary(int num) {
|
|
for (int shift = 31; shift >= 0; --shift) {
|
|
System.out.print((num >> shift) & 1);
|
|
}
|
|
System.out.println();
|
|
}
|
|
|
|
public static void main(String[] args){
|
|
boolean run = true;
|
|
while(run){
|
|
int next = iterator();
|
|
System.out.println("Int: " + next);
|
|
System.out.print("Bin: ");
|
|
printBinary(next);
|
|
run = next != 0;
|
|
}
|
|
}
|
|
}
|