String Calculator in Java