Im trying to get the max number of characters from sql table.
Example: lorem ipsum - 11 characters; lorem ipsum dolor - 17 characters; => max = 17;
For now i can get the number of characters for each column:
while (rs2.next()) {
nume = rs2.getString(1);
CNP = rs2.getString(2);
adresa = rs2.getString(3);
String[] arr = { nume, CNP, adresa };
int max = maxLength(arr);
static int maxLength(String[] arr) {
int len = 0;
int N = arr.length;
List<String> list = new ArrayList<String>();
// Traverse the array
for (int i = 0; i < N; i++) {
// Stores the length of current String
int l = arr[i].length();
// Update maximum length
if (len < l) {
len = l;
}
}
// Return the maximum length
return len;
}