public class ArrayResizer {
    public static boolean isNonZeroRow(int[][] array2D, int r) {
        for (int i = 0; i < array2D[r].length; i++) { // loop through the contents of the row
            if (array2D[r][i] == 0) { // if any number is a 0, return false immediately 
                return false;
            }
        }
        return true; // else if no 0's found, return true
    }

    public static int numNonZeroRows(int[][] array2D) {}

    public static int[][] resize(int[][] array2D) {
        int[][] resize = new int[numNonZeroRows(array2D)][array2D[0].length]; // create a new 2D array with the number of nonzero rows as the rows, and the input columns as columns
        int index = 0; //index of row of new array
        for (int i = 0; i < array2D.length; i++) {
            if (isNonZeroRow(array2D, i)) { // if the row looped through is a nonzero row,
                resize[index] = array2D[i]; // set the current row of the new array to match the row of the old array
                index++; //increment the index of the row of the new array
            }
        }
        return resize; //return when finished
    }
}