Update Problem004.java

Added problem 4 code