Buggy code:
display = ( display . substring ( 0 , ( ( display . length ( ) ) - 1 ) ) ) + "+" ; } else { equation += "+" ; lastNum = currNum ; currNum = "" ; display += "+" ; } outputEq . setText ( display ) ; } } ) ; minus . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View v ) { if ( ( equation . isEmpty ( ) ) && ( ! ( lastAns . isEmpty ( ) ) ) ) { lastNum = lastAns ; equation = ( lastAns ) + "-" ; display = ( lastAns ) + "-" ; } else if ( equation . isEmpty ( ) ) if ( Numbers . lastInputIsOperator ( equation ) ) { equation = ( equation . substring ( 0 , ( ( equation . length ( ) ) - 1 ) ) ) + "-" ; display = ( display . substring ( 0 , ( ( display . length ( ) ) - 1 ) ) ) + "-" ; } else { equation += "-" ; lastNum = currNum ; currNum = "" ; display += "-" ; } outputEq . setText ( display ) ; } } ) ; multiply . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View v ) { if ( ( equation . isEmpty ( ) ) && ( ! ( lastAns . isEmpty ( ) ) ) ) { lastNum = lastAns ; equation = ( lastAns ) + "*" ; display = ( lastAns ) + "×" ; } else if ( equation . isEmpty ( ) ) if ( Numbers . lastInputIsOperator ( equation ) ) { equation = ( equation . substring ( 0 , ( ( equation . length ( ) ) - 1 ) ) ) + "*" ; display = ( display . substring ( 0 , ( ( display . length ( ) ) - 1 ) ) ) + "×" ; } else { equation += "*" ; lastNum = currNum ; currNum = "" ; display += "×" ; } outputEq . setText ( display ) ; } } ) ; divide . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View v ) { if ( ( equation . isEmpty ( ) ) && ( ! ( lastAns . isEmpty ( ) ) ) ) { lastNum = lastAns ; equation = ( lastAns ) + "//" ; display = ( lastAns ) + "÷" ; } else if ( equation . isEmpty ( ) ) if ( Numbers . lastInputIsOperator ( equation ) ) { equation = ( equation . substring ( 0 , ( ( equation . length ( ) ) - 1 ) ) ) + "//" ; display = ( display . substring ( 0 , ( ( display . length ( ) ) - 1 ) ) ) + "÷" ; } else { equation += "//" ; lastNum = currNum ; currNum = "" ; display += "÷" ; } outputEq . setText ( display ) ; } } ) ; percent . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View v ) { if ( equation . isEmpty ( ) ) <START_BUG> if ( ( Numbers . lastInputIsOperator ( equation ) ) || ( Numbers . lastInputIsPercent ( equation ) ) ) { <END_BUG> equation = equation . substring ( 0 , ( ( equation . length ( ) ) - ( currNum . length ( ) ) ) ) ; String converted = Numbers . percentage ( currNum , lastNum ) ; equation += converted ; display += "%" ; outputEq . setText ( display ) ; } } } ) ; negative . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View v ) { if ( equation . isEmpty ( ) ) { if ( currNum . contains ( "-" ) ) currNum = currNum . substring ( 1 ) ; else currNum = "-" + ( currNum ) ; equation += currNum ; display += currNum ; } else if ( Numbers . lastInputIsPercent ( display ) ) { String converted = Numbers . percentage ( currNum , lastNum ) ; display = display . substring ( 0 , ( ( ( display . length ( ) ) - ( currNum . length ( ) ) ) - 1 ) ) ; equation = equation . substring ( 0 , ( ( equation . length ( ) ) - ( converted . length ( ) ) ) ) ; if ( currNum . contains ( "-" ) ) { currNum = currNum . substring ( 1 ) ; display += ( currNum ) + "%" ; equation += converted . substring ( 1 ) ; } else { currNum = "-" + ( currNum ) ; display += ( currNum ) + "%" ; equation += "-" + converted ; } } else if ( ( ( display . charAt ( ( ( display . length ( ) ) - 1 ) ) ) == 'e' ) || ( ( display . charAt ( ( ( display . length ( ) ) - 1 ) ) ) == 'π' ) ) { char constant = display . charAt ( ( ( display . length ( ) ) - 1 ) ) ; if ( currNum . contains ( "-" ) ) { currNum = currNum . substring ( 1 ) ; equation = ( equation . substring ( 0 , ( ( equation . length ( ) ) - 14 ) ) ) + ( currNum ) ;

Fix:
if ( ( Numbers . lastInputIsOperator ( equation ) ) || ( ( equation . charAt ( ( ( equation . length ( ) ) - 1 ) ) ) == '%' ) ) {