Store pr of arr [ i ] and W [ i ]
Vector < Pair > pr = new Vector < > ( ) ; for ( int index = 0 ; index < arr . size ( ) ; index ++ ) pr . add ( new Pair ( arr . get ( index ) , W . get ( index ) ) ) ;