This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Revere elements Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Revere elements" Watch "Revere elements" New topic
Author

Revere elements

Amit Chohan
Greenhorn

Joined: Oct 31, 2002
Posts: 29
hi all
the following code reverses elements in an array. Is there a more efficient way of writing it.

thanks
Amit Chohan


Java Junior<br />Leicester<br />England
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
hi amit,
it seems the method u use is fine in int[] case.
here is the code i tired,

and a script to generate multiple results to get average,

the average was,
Reverse-1: 275.65
Reverse-2: 747.40
Reverse-3: 474.40
Reverse-4: 808.24
Reverse-5: 802.33

may be if we post this to Performance forum it would get more responses...
regards
maulin.
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
btw,
the average is in milliseconds to perform reverse operation...
thanks
maulin
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Revere elements
 
Similar Threads
array
Accessing servlet-config parameter through EL
New ArrayList Problem
Error! Array Index Out Of Bounds Exception
Can I pass an array of ints to a class?