Complex Calculator in Java