Also, your program is difficult to read because you haven't aligned everything properly. Indent your code properly so that you can clearly tell where each block of statements (if, while-loop, for-loop, method, class, etc.) begins and ends. Imagine your mailbox being in front of your neighbor's house three houses away from yours. That would be confusing for the mailman delivering your mail, right? You're liable to get your mail misdirected. Improperly indented code is like that to people reading your code. They can't easily tell which statements logically go with each other.
Other languages like Python actually require you to indent your code properly in order for the program to behave correctly.
Java, however, doesn't care about indentation. Indentation is for the human reader's benefit. So, indent your programs properly for the benefit of its human readers, including yourself.
Refer to the following for guidelines:
http://www.javaranch.com/styleLong.jsp
http://www.oracle.com/technetwork/java/javase/documentation/codeconventions-136091.html
If you are using an
IDE like Eclipse, you can have it format your code for you. Just press Ctrl+Shift+F or Cmd+Shift+F (on Mac).