Take the code below and add methods to initialize the array to make what is in the comments. The first one is done for you.
//initializing arrays
public class initialize
{
public static void main (String args [])
{
int size = 30;
int a [] = new int [size];
//0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
allZeros (a, size);
printarray (a, size);
//1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
allOnes (a, size);
printarray (a, size);
//0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
zeroOnes (a, size);
printarray (a, size);
//0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2
zeroOneTwo (a, size);
printarray (a, size);
//0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
counting (a, size);
printarray (a, size);
//1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 continues...
// and then: 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040
fibonacci(a,size);
printarray(a,size);
}
public static void printarray (int a [], int size)
{
for (int i = 0 ; i < size ; i++)
{
System.out.print (a [i] + " ");
}
System.out.println ();
}
public static void allZeros (int a [], int size)
{
for (int i = 0 ; i < size ; i++)
{
a [i] = 0;
}
}
}