question: private void buildFirstLine ( LinePath path , Rect r ) { int [ ] range = new int [ ] { - r . left , - r . top , r . right , r . bottom } ; int max = - 1 ; int maxId = 0 ; for ( int i = 0 ; i < 4 ; i ++ ) { if ( range [ i ] > max ) { max = range [ i ] ; maxId = i ; } } switch ( maxId ) { case 0 : path . setEndPoint ( r . left , Utils . nextInt ( r . height ( ) ) + r . top ) ; break ; case 1 : path . setEndPoint ( Utils . nextInt ( r . width ( ) ) + r . left , r . top ) ; break ; case 2 : path . setEndPoint ( r . right , Utils . nextInt ( r . height ( ) ) + r . top ) ; break ; case 3 : path . setEndPoint ( Utils . nextInt ( r . width ( ) ) + r . left , r . bottom ) ; break ; } path . lineToEnd ( ) ; }
target:  Line to the the farthest boundary, in case appear a super big piece.