operators - JAVA Equals Alternative -


i wondering if there alternative following operator:

if (f == 0){     system.out.print(""); } else if (i %2 == 1){     system.out.print("; "); } 

to clearer, alternative way of writing if statement's "==" , else if statement's %2 == 1.

thanks.

system.out.print(f!=0 && i%2==1 ? "; " : "");

instead of modulo can flag out bits of except last 1 bitwise and.

the alternative i%2 i&1.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -