package test;
import java.util.Random;
public class ArrayTest {
public static void main(String[] args) {
int y = 2, x = 2;
int[][] data = new int[y][x];
Random r = new Random();
int index = 0;
do {
data[index / x][index % x] = r.nextInt();
} while (++index < x * y);
int sum = 0;
for (int[] is : data) {
for (int i : is) {
System.out.print(i + "\t");
sum += i;
}
}
System.out.println("sum=" + sum);
}
}