public class WhileClass{ static int anzBits(int n){ int bits=1; // mindestens ein Bit while (n > 1){ // solange n noch > 1 bits++; // man braucht ein weiteres Bit n = n/2; // halbieren von n pro Bit } return bits; } static void while1(){ int i=0; while (i++<3) System.out.println(i); System.out.println ("nachher: " + i); } static void while2(){ int i=0; while (++i<3) System.out.println(i); System.out.println ("nachher: " + i); } }