Calculate the rectangular ratio and save them
for ( int i = 0 ; i < rows ; i ++ ) { double rectRatio = ( double ) sides [ i ] [ 0 ] / sides [ i ] [ 1 ] ; if ( ratio . get ( rectRatio ) == null ) { ratio . put ( rectRatio , 0 ) ; } ratio . put ( rectRatio , ratio . get ( rectRatio ) + 1 ) ; }