top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

How to reverse an array in Java?

+3 votes
84 views
How to reverse an array in Java?
posted Mar 28, 2015 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Something like -

for(int i = 0; i < mydata.length/2; i++)
{
    int temp = mydata[i];
    mydata[i] = mydata[mydata.length - i - 1];
    mydata[mydata.length - i - 1] = temp;
}
answer Mar 30, 2015 by Salil Agrawal
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...