Here you can find the source of maxInColumns(ArrayList
static public ArrayList<String> maxInColumns(ArrayList<String> lines)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; public class Main { static public ArrayList<String> maxInColumns(ArrayList<String> lines) { ArrayList<ArrayList<String>> valuesInColumns = valuesInColumns(lines); ArrayList<String> result = new ArrayList<String>(); for (int i = 0; i < valuesInColumns.size(); i++) { ArrayList<String> values = valuesInColumns.get(i); Double max = null;/* ww w . ja v a2s. c om*/ for (String value : values) { try { Double currentValue = Double.parseDouble(value); if (max == null) max = currentValue; if (max < currentValue) max = currentValue; } catch (Exception e) { max = null; break; } } result.add(max + ""); } return result; } static public ArrayList<ArrayList<String>> valuesInColumns( ArrayList<String> lines) { ArrayList<ArrayList<String>> valuesInColumns = new ArrayList<ArrayList<String>>(); for (int row = 0; row < lines.size(); row++) { String[] values = lines.get(row).replace("<,>", "<>") .split(","); for (int i = 0; i < values.length; i++) { if (valuesInColumns.size() <= i) { valuesInColumns.add(new ArrayList<String>()); } valuesInColumns.get(i).add(values[i]); } } return valuesInColumns; } }