Created
June 5, 2016 13:22
-
-
Save brendandawes/a7a3e944164dca9d3c27ccbbed1bfa89 to your computer and use it in GitHub Desktop.
Processing:Get Min Max Values from Table rows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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