if number is prime then store it in prime vector
Vector < Integer > prime = new Vector < Integer > ( ) ; for ( int i = 0 ; i <= MAX ; i ++ ) if ( pm [ i ] ) prime . add ( i ) ; return prime ; } static int max_element ( int arr [ ] ) { int max = arr [ 0 ] ; for ( int i = 0 ; i < arr . length ; i ++ ) max = Math . max ( max , arr [ i ] ) ; return max ; }