if (str1 == "END"){
is not the correct way to perform string equality tests. Use:
Code:
if (str1.equals("END"))  {