Posts

Showing posts from March, 2014

Reversing of char array using java

Hi everyone, in this blog post I will writing about reversing a char array using java. This program requires a char array as its input and it will return the reversed version of that char array. The program which I have written to demonstrate reversing of char array is as follows: package  com.techjourney.methods; public   class  ReversingCharArray {           public   static   void  main(String args[])     {          char  firstArray[] =  new   char []{ 'G' , 'i' , 'l' , 'c' , 'h' , 'r' , 'i' , 's' , 't' };          char  secondArray[] =  new   char []{ 'D' , 'r' , 'a' , 'v' , 'i' , 'd' };                  System.out.println( " First array before reversing - " );         System.out.println(firstArray);                  System.out.println( " First array after reversing - " );         charReversal(firstArray);         System.o