I am doing some Junit testing on my code, which is meant to produce an arraylist of n prime numbers. I want to compare the created list to a list of known prime numbers in an array, and to do this I need to insert multiple values into an array in my testing class.
So what I have at the moment is
int knownPrimes[] = new int[50];
I know that I could insert values into this array by typing
knownPrimes[1] = 2;
knownPrimes[2] = 3;
etc etc.
I was just wondering how I would do this all in one big chunk, maybe something like:
knownPrimes[] = {2,3,5,7,9...};
but I am not sure of the syntax and I can't find anything on google. Would anyone be able to help me out please ?
Thanks a lot.