The top of the stack modulo k is greater than ( temp & k ) or if they are equal then compare the values
if ( ( tmpStackMod > tmpMod ) || ( tmpStackMod == tmpMod && ( int ) tmpStack . Peek ( ) > tmp ) ) {