public void reverse ( ) { // overridden for performance only. double tmp ; int limit = size / 2 ; int j = size - 1 ; double [ ] theElements = elements ; for ( int i = 0 ; i < limit ; ) { //swap tmp = theElements [ i ] ; theElements [ i ++ ] = theElements [ j ] ; theElements [ j -- ] = tmp ; } }
Reverses the elements of the receiver . Last becomes first second last becomes second first and so on .