This method should return a new matrix with each of its dimensions halved in size. The way to do this is to “compress” the matrix by taking each 2 by 2 block of the original matrix, averaging the 4 values, and replacing it by the 1 average. You may assume that the matrix has even dimensions in both directions.

The header should look something like this:

public static int[][] halfSize(int[][] m)