I have the following code that takes integers and stores it in a array of booleans according to the position. I have a method include that allows the user to input more numbers into the array however if the number is bigger than the array size then I need to increase the size. I am aware that you can't do much with arrays once they are made just change what's in each position. Is there a quick way to make it bigger or could I use arraylists to keep the array size changing?
public class ISet {
public int max;
boolean[] numArray;
ISet(int a) {
this.size = a;
this.numArray = new boolean[size];
}
public void include(int n) {
if (n > size) {
this.size = n;
numArray[n]=true;
}
else
numArray[n]=true;
}
java.lang.System.arraycopy(...);