Ascii to string in java

Java convert ascii to string java example

package com.w3schools;

public class ASCIIToString {
  public static void main(String args[]){
	try {
             int num[] = {66, 118, 98, 75};
             String str =null;
             for(int i: num){
               str = Character.toString((char)i);
               System.out.println(str);
             }
	} catch (Exception e) {
		e.printStackTrace();
	}
  }
}

Output:

B
v
b
K

Download this example.

Please follow and like us:
Content Protection by DMCA.com