Skip to content

Instantly share code, notes, and snippets.

@brendandawes
Created June 5, 2016 13:22
Show Gist options
  • Save brendandawes/a7a3e944164dca9d3c27ccbbed1bfa89 to your computer and use it in GitHub Desktop.
Save brendandawes/a7a3e944164dca9d3c27ccbbed1bfa89 to your computer and use it in GitHub Desktop.
Processing:Get Min Max Values from Table rows
int getMinValue(Table t, String colName){
int minValue = Integer.MAX_VALUE;
for (TableRow row: t.rows()) {
int val = row.getInt(colName);
if (val < minValue) minValue = val;
}
return minValue;
}
int getMaxValue(Table t, String colName){
int maxValue = Integer.MIN_VALUE;
for (TableRow row: t.rows()) {
int val = row.getInt(colName);
if (val > maxValue) maxValue = val;
}
return maxValue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment