In Java, I'd like to get the maximum element from both dimensions of a simple image array, ie:
int getWidth(Color[][] pixels){
//return max of dimension 1
}
int getHeight(Color[][] pixels){
//return max of dimension 2
}
I know how to do this for a 1D array in Java, I would just run a for loop with the condition of i < pixels.length. However, I'm not quite sure how .length works for a 2D array, or even if it does work. How would I approach this?