Assuming first plate to be of maximum size
int lastLength = Integer . MAX_VALUE ; int lastWidth = Integer . MAX_VALUE ; System . out . println ( countPlates ( plates , lastLength , lastWidth , 0 , n ) ) ; } }