Hi,
the last thing I want to minimize today is code that contains while and do-while loops. Here is the original:
class Vereinfache3_edit {
public static void main(String [] args) {
int c1 = Integer.parseInt(args[0]) ;
int c2 = Integer.parseInt(args[1]) ;
int c3 = Integer.parseInt(args[2]) ;
/* 1 */ c1 += 7 ;
/* 2 */ System.out.println( c1 ) ;
/* 3 */ while (c1 % 8 != 0)
/* 4 */ if ( c1 % 16 == 0 ) ;
/* 5 */ else
/* 6 */ do
/* 7 */ {
/* 8 */ c1 += 7 ;
/* 9 */ System.out.println( c1 ) ;
/* 10 */ if ( c2 < c3 )
/* 11 */ { c1 = c1+c1 ;
/* 12 */ c3 ++ ;
/* 13 */ c1 /= 2 ;
/* 14 */ c3 -= 1 ;
/* 15 */ }
/* 16 */ }
/* 17 */ while ( c1 % 8 != 0 ) ;
/* 18 */ c1 += 7 ;
/* 19 */ System.out.println( c1 ) ;
}
} // end of class Vereinfache3
And here is my minimized version:
class Vereinfache3 {
public static void main(String [] args) {
int c1 = Integer.parseInt(args[0]);
int c2 = Integer.parseInt(args[1]) ;
int c3 = Integer.parseInt(args[2]) ;
do{
c1 += 7 ;
System.out.println( c1 ) ;
}while (c1 % 8 != 0);
/* 18 */ c1 += 7 ;
/* 19 */ System.out.println( c1 ) ;
}
} // end of class Vereinfache3
It generates the same output for me. Do you see any errors or things that can be improved?
Especially this code seems to be tricky:
/* 3 */ while (c1 % 8 != 0)
/* 4 */ if ( c1 % 16 == 0 ) ;
/* 5 */ else
/* 6 */ do{}
How do I deal with the while? What contains the while loop?