nullpointerexception arrray = array.clone not working?
<p>Down in the second class named paintthis, in the constructor i declare that array = array.clone, and it says that there is nothing in the array? I declare the array in LineGraph and then put the array into the peramiters, which there is a constructor of the second class names painthis with the arguments int[] array.</p>

<pre><code>package javatestframming;

import java.awt.geom.*;
import javax.swing.*;
import java.awt.*;
import java.util.*;

public class LineGraph extends JFrame{
    public LineGraph(){
        super("Line Graph");
        int[] array = {1, 2, 3, 4, 5, 7, 8, 9};
        setSize(400, 400);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        paintthis gpane = new paintthis(array);

        add(gpane);
        setVisible(true);
    }

    public static void main(String[] args){
        LineGraph lg = new LineGraph();
    }
}

class paintthis extends JPanel{
    int[] xpoints;
    paintthis(int[] array){
        xpoints = array.clone;
    }
    int max = arrayGetMaxInt(xpoints);
    int min = arrayGetMinInt(xpoints);
    int divisable = findDivisableWholeNumber(max, min);
    Font f = new Font("Arial", Font.BOLD, 14);
    FontMetrics fm = getFontMetrics(f);

    public void paintComponent(Graphics g){
        Graphics2D g2d = (Graphics2D) g;
        super.paintComponents(g);
        int graphHeight = 200;
        int graphWidth = 200;
        int graphX = 10;
        int graphY = 10;
        float borderThickness = 5.0f;
        //set graph background and border
        g2d.setColor(Color.white);

        g2d.fillRect(graphX, graphY, graphWidth, graphHeight);

        g2d.setColor(Color.GRAY);
        BasicStroke bs = new BasicStroke(borderThickness, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
        g2d.setStroke(bs);

        g2d.drawLine(graphX - (int)borderThickness, graphY, graphX + graphWidth, graphY);
        g2d.drawLine(graphX - (int)borderThickness, graphY + graphHeight, graphX + graphWidth, graphY + graphHeight);
        g2d.drawLine(graphX - (int)borderThickness, graphY, graphX - (int)borderThickness, graphY + graphHeight);
        g2d.drawLine(graphX + graphWidth, graphY, graphX + graphWidth, graphY + graphHeight);

        int trueGraphWidth = graphWidth - drawYAxis(g2d, graphWidth, graphHeight, max, min, divisable, graphY, graphX);
        int trueGraphHeight = graphHeight - drawXAxis(g2d, graphY + graphHeight - fm.getHeight(), graphX, graphWidth, (int)borderThickness);
        System.out.println(trueGraphWidth + " " + graphWidth);
        drawPoints(g2d, trueGraphWidth, trueGraphHeight, (graphWidth - trueGraphWidth) + (int)borderThickness + graphX, (graphHeight - trueGraphHeight) + (int)borderThickness + graphY);
    }

    public int drawYAxis(Graphics2D g, int graphWidth, int graphHeight, int max, int min, int counts, int beginingpoint, int overx){
        graphHeight -= fm.getHeight();
        int averageSpaceInBetween = ((graphHeight-fm.getHeight())/((max - min)/counts)); //- ((fm.getHeight()/(graphHeight/fm.getHeight())));
        int space = 0;
        Stack&lt;Integer&gt; stackAxisNumbers = new Stack&lt;Integer&gt;();

        g.setFont(f);

        for (int x = 0; x &lt;= (max - min); x+=counts){
            stackAxisNumbers.add(x + min);
        }

        for (int x = 0; x &lt;= (max - min); x+= counts){
            g.drawString("$" + Integer.toString(stackAxisNumbers.pop()), overx, space + beginingpoint + fm.getHeight());
            space += averageSpaceInBetween;
        }

       space = 0;
       return fm.stringWidth("$" + Integer.toString(max));
    }
    public int drawXAxis(Graphics2D g,  int beginingpoint, int overx, int graphWidth, int borderThickness){
        g.drawLine(overx - borderThickness, beginingpoint, overx + graphWidth, beginingpoint);
        return beginingpoint - fm.getHeight();
    }

    public void drawPoints(Graphics2D g, int graphWidth,int graphHeight, int startX, int startY){
        g.setColor(Color.blue);
        int xSpace = (int) graphWidth/xpoints.length;
        g.drawLine(startX, startY, xSpace + startX, xpoints[0]);
    }

    public int arrayGetMaxInt(int[] array){
        int max = 0; 
       for (int x: array){
           if (x &gt; max){
               max = x;
            }
        }

        return max;
    }
    public int arrayGetMinInt(int[] array){
        int min = max;
        for (int x: array){
            if (x &lt; min){
                min = x;
            }
        }
        return min;
    }
    public int power(int base, int exp){
        int num = base;
        for (int x = 1; x &lt; exp; x++){
            num = num * base;
        }
        if (exp == 0){
            num = 1;
        }
        return num;
    }
    public int findDivisableWholeNumber(int max, int min){
        boolean passed = false;
        int range = max - min;
        int divis = 1;
        int multiplier = 1;
        out:
        for (int x = 5; x &gt; 0; x--){
            if (range &gt;= power(10, x)){
                multiplier = x;
                break;
            }
        }
        out:
        for (int x = 10 * multiplier; x &lt;= 10 * multiplier &amp;&amp; x &gt; 0; x--){
            if(range%((int)(range/x)) == 0){
                divis = x;
                passed = true;
                break;
            }
        }
        if (passed == false){
            out:
            for (int x = 11  * multiplier; x &lt;= (int)(range / 2); x++){
                if(range%((int)(range/x)) == 0){
                    divis = x;
                    passed = true;
                    break;
                }
            }
        }
        if (passed == false){
            System.out.println("ERROR -- NoWholeDiviableNumbersException");
            System.exit(0);
        }
        return divis;
    }
}
</code></pre>

<p>Exception is:</p>

<pre><code> Exception in thread "main" java.lang.NullPointerException
at javatestframming.paintthis.arrayGetMaxInt(LineGraph.java:97)
at javatestframming.paintthis.&lt;init&gt;(LineGraph.java:31)
at javatestframming.LineGraph.&lt;init&gt;(LineGraph.java:15)
at javatestframming.LineGraph.main(LineGraph.java:22)
C:\Users\Morgan Higginbotham\AppData\Local\NetBeans\Cache\8.1\executor-    snippets\run.xml:53: Java returned: 1
</code></pre>

<p>BUILD FAILED (total time: 1 second)</p>