A recent requirement was to connect to our system via OA, and then request to have the Base64 encrypted string, and the first and last position reversed, so you need to restore the normal encryption string before decrypting.
So the first thing to do is to test and restore the encrypted string, that is, the first one with the most one character position exchange.
The test code is as follows:
private static void Test2 () {String st= "012345 ="; String firstchar=string.valueof (St.charat (0)); String lastchar=string.valueof (St.charat (St.length ()-1)); String middlestring=st.substring (1,st.length ()-1); String Str=lastchar+middlestring+firstchar; System.out.println ("Original string:" +st); System.out.println ("First string:" +firstchar); System.out.println ("Last string:" +lastchar); System.out.println ("The middle string:" +middlestring); System.out.println ("String after combination:" +str);}
Results:
Original string: 012345 =
First string: 0
Last string: =
Middle of string: 12345
String after combination: =123450
Java string The first character and the last character reverse the position test