Search code examples
javac#keypressutf-16

Equivalent of C# code for encoding in java


I need to know what is the Java equivalent for the following code. I need to pass function keys as string in Java. The following code in C# is working. I need to know how to do this in Java.

String escKey = System.Text.Encoding.ASCII.GetString(new byte[] {27});

String f1Key = escKey+ "[11~";

Solution

  • You can use the following method:

    Character.toString((char)27);