Online Java Compiler By
JavaTpoint.com
public class JavaCharacterReverseBytesExample2 { public static void main(String[] args) { // Create two char primitives ch1 and ch2. char ch1, ch2; // Assign the values to ch1. ch1 = '\u5d00'; ch2 = '\u4d00'; // Assign the result of reverseBytes in ch3 and ch4. char ch3 = Character.reverseBytes(ch1); char ch4 = Character.reverseBytes(ch2); String str1 = "The reversing of bytes for the first character is given as: " + ch3; String str2 = "The reversing of bytes for the second character is given as: " + ch4; // print the value. System.out.println( str1 ); System.out.println( str2 ); } }
Output