-1

Can you please advise how to reverse an array without using an additional buffer , which is the best algorithm to achieve this as for example i have the below class consists of an array , i am looking for the best algorithm so that i do not need to create an extra buffer or an extra array while reversing the array

public class ardem
{ 
public static void main(String[] args) 
{ int[] numbers = {1, 2, 3, 4, 5, 6, 7};

}
}

well I don't want to use any predefined method of api i want to create my own please advise how to achieve this

user1620642
  • 79
  • 10

1 Answers1

0

There already exists an implementation of it:

ArrayUtils.reverse(int[] array)

in Commons.Lang.

Tom
  • 16,842
  • 17
  • 45
  • 54
Michał Szydłowski
  • 3,261
  • 5
  • 33
  • 55