java

How to Convert ASCII Code to String in Java

In this tutorial, we are going to see how to convert ASCII code to string in Java. The following example converts an ASCII array of characters to a String.
 

Java Program to Convert ASCII Code to String :
public class Main {
  
    public static void main(String[] args) {
        
       int ascii[] = {83,116,97,99,107,72,111,119,84,111};
      
        String str = null;
      
        for (int i: ascii) {
            str = Character.toString((char) i);
            System.out.print(str);
        }
    }
}

Output:

StackHowTo
mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *