I'm trying to take a given array and increment the capacity by a certain integer. The program runs and returns the original and incremented array with the same length. Any ideas?
public static void main(String[] args) { double[] james=new double[15]; System.out.println("The array james has: "+james.length+" spaces"); expand(james,5); System.out.println("The array now has: "+james.length+" spaces"); } public static void expand(double [] x, int howManyMore) { double [] newX=new double[x.length+howManyMore]; for(int i=0;i<x.length;i++) { newX[i]=x[i]; } x=new double[newX.length]; for(int i=0;i<newX.length;i++) { x[i]=newX[i]; } } }