for(int i=0; i<100; i++) { str = br.readLine(); System.out.println("String"+ i + str); if(str.equals("stop")) break; }