// or chain alternative to a HashSet if ( a == 10 || a == 100 || a == 1000 ) { out.println( "is power of 10" ); }