text: Iterator < Integer > index = arr . iterator ( ) ;
code: int index ; int temp ; index = arr . get ( i ) ; temp = arr . get ( i + 1 ) ; arr . removeElement ( index ) ; arr . add ( i , temp ) ; arr . removeElement ( temp ) ; arr . add ( i + 1 , index ) ; moved ++ ; } } j ++ ; if ( moved == 0 ) { break ; } } System . out . print ( arr ) ; }