Writing polynomials from the command-line in Java