code: public static void matrixFill(Object[][] matrix, Object val) {
          if (matrix != null) {
              for (int i = 0, n = matrix.length; i < n; i++) {
                  if (matrix[i] != null) {
                      for (int j = 0, m = matrix[i].length; j < m; j++) {
                          matrix[i][j] = val;
                      }
                  }
              }
          }
      }
docs: Fills a 2D array with a value. Nothing happens if <code>matrix</code> is
  <code>null</code>. Likewise, nothing happens to a <code>null</code> row.
  
  @param matrix a 2D <code>Object[]</code> array.
  @param val an <code>Object</code> value.