private void checkSystemInput ( ) throws IOException { while ( System . in . available ( ) > 0 ) { int input = System . in . read ( ) ; if ( input >= 0 ) { char c = ( char ) input ; if ( c == ' ' ) { synchronized ( lock ) { finished = true ; lock . notifyAll ( ) ; } } } else { synchronized ( lock ) { finished = true ; lock . notifyAll ( ) ; } } } }
Checks for the user pressing Enter .