I was writing a polynomial class and implementing some simple methods, but I wanted to implement higher order polynomials without vastly increasing the amount of code written. So far, the methods within are very simple (such as adding); but if I add higher order polynomials to the constructor, the methods will have to be very long to accommodate the numerous arguments the constructor will take. I was wondering if there is a more analytic way to implement these functions, as in directly specifying their logic rather than just writing them out.
Here is my code so far:

```
class Polynomial {

final static int MAX_DEGREE = 4;

private int x0;
private int x1;
private int x2;
private int x3;
private int x4;

Polynomial() {
    this(0);
}

Polynomial(int x0) {
    this(x0, 0);
}

Polynomial(int x0, int x1) {
    this(x0, x1, 0);
}

Polynomial(int x0, int x1, int x2) {
    this(x0, x1, x2, 0);
}

Polynomial(int x0, int x1, int x2, int x3) {
    this(x0, x1, x2, x3, 0);
}

Polynomial(int x0, int x1, int x2, int x3, int x4) {
    this.x0 = x0;
    this.x1 = x1;
    this.x2 = x2;
    this.x3 = x3;
    this.x4 = x4;
}

public static Polynomial add(Polynomial p1, Polynomial p2) {
    return new Polynomial((p1.x0 + p2.x0), (p1.x1 + p2.x1), (p1.x2 + p2.x2), (p1.x3 + p2.x3), (p1.x4 + p2.x4));
}

public static int getGetx(int i, Polynomial p) {
    if (i == 0) return p.x0;
    else if (i == 1) return p.x1;
    else if (i == 2) return p.x2;
    else if (i == 3) return p.x3;
    else if (i == 4) return p.x4;
    else throw new IllegalArgumentException("Degree called is too big");
}

public static Polynomial negate(Polynomial p) {
    return new Polynomial(-1*p.x0, -1*p.x1, -1*p.x2, -1*p.x3, -1*p.x4);
}

public static Polynomial subtract(Polynomial p1, Polynomial p2) {
    return new Polynomial((p1.x0 - p2.x0), (p1.x1 - p2.x1), (p1.x2 - p2.x2), (p1.x3 - p2.x3), (p1.x4 - p2.x4));
}

public static Polynomial simplePolynomialDerivative(Polynomial p) {
    return new Polynomial(p.x1, 2 * p.x2, 3 * p.x3, 4 * p.x4);
}

public static Polynomial stringToPolynomial(String s) {
    if (s.contains("a") | s.contains("b") | s.contains("c") | s.contains("d") | s.contains("e") | s.contains("f") | s.contains("g") | s.contains("h") | s.contains("i") | s.contains("j") | s.contains("k") | s.contains("l") | s.contains("m") | s.contains("n") | s.contains("o") | s.contains("p") | s.contains("q") | s.contains("r") | s.contains("s") | s.contains("t") | s.contains("u") | s.contains("v") | s.contains("w") | s.contains("y") | s.contains("z") | s.contains("!") | s.contains("@") | s.contains("#") | s.contains("$") | s.contains("%") | s.contains("&"))
        throw new IllegalArgumentException("Polynomials may only include independent variable x and numeric types"); //contains bad stuff
    else {
        //do stuff here
    }
    return new Polynomial();
}

public static void printPolynomial(Polynomial p) {
    for (int i = 0; i <= MAX_DEGREE; i++) {
        if (!(getGetx(i, p) == 0)) {
            if (!(i == 0)) System.out.print(" + ");
            if (i == 0) System.out.print(p.x0);
            else if (i == 1) System.out.print(p.x1 + "x");
            else System.out.print(p.getGetx(i, p) + "x^" + i);
        }
    }
}

public static String polynomialToString(Polynomial p) {
    StringBuilder s = new StringBuilder("");
    for (int i = 0; i <= MAX_DEGREE; i++) {
        if (!(getGetx(i, p) == 0)) {
            if (!(i == 0)) s.append(" + ");
            if (i == 0) s.append(p.x0);
            else if (i == 1) s.append(p.x1).append("x");
            else s.append(p.getGetx(i, p)).append("x^").append(i);
        }
    }
    return s.toString();
}

public static double polynomialSubstitute(double i, Polynomial p) {
    return ((p.x0 + i*p.x1 + (Math.pow(i,2))*p.x2 + (Math.pow(i,3))*p.x3 + (Math.pow(i,4))*p.x4));
}

public static long numericalDerivative(Function f) {

    return 0L;
}

public static void main(String[] args) {
    Polynomial p = new Polynomial(1,5,3,2);
    Polynomial pD = simplePolynomialDerivative(p);
    double k = 0.0;
    for(int i = 1; i<100; i++) {
        k -= polynomialSubstitute(k,p)/polynomialSubstitute(k,pD);

    }
    System.out.println(k);
}
}

```

Guessing leads me to believe that the solution lies within the new Java 8 lambdas, but as I am not experienced with them, some help would be greatly appreciated. Also, I have not yet coded numericalDerivative() and stringToPolynomial() yet, so you can ignore those. You can see that I have already had to get around this problem with my use of getGetx().