code: private static int[] getWidths(String[] headers, String[][] data) {
          final int[] widths = new int[headers.length];
          for (int j = 0; j < headers.length; j++) {
              final String header = headers[j];
              widths[j] = Math.max(widths[j], header != null ? header.length() : 0);
          }
          for (String[] rowValues : data) {
              for (int j = 0; j < rowValues.length; j++) {
                  final String value = rowValues[j];
                  widths[j] = Math.max(widths[j], value != null ? value.length() : 0);
              }
          }
          return widths;
      }
docs: Returns the column widths required to print the header and data
  
  @param headers the headers to print
  @param data    the data items to print
  @return the required column widths