Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static String reverseOrder(String s) {

        char[] chA = s.toCharArray();
        int l = s.length();
        for (int i = 0; i < l / 2; i = i + 2) {
            char cTmp1 = 0;
            char cTmp2 = 0;
            cTmp1 = chA[i];
            cTmp2 = chA[i + 1];
            chA[i] = chA[l - i - 2];
            chA[i + 1] = chA[l - i - 1];
            chA[l - i - 2] = cTmp1;
            chA[l - i - 1] = cTmp2;
        }
        String sRet = new String(chA);
        return sRet;
    }
}