Polynomial calculating program written in java