In this tutorial we will learn how to convert ASCII values to a String.
Example: Converting ASCII to String
Here is the complete code wherein we have an array of ASCII values and we are converting them into corresponding char values then transforming those chars to string using toString() method of Character class.
package com.beginnersbook.string; public class ASCIIToString { public static void main(String args[]){ int num[] = {65, 120, 98, 75, 115}; String str =null; for(int i: num){ str = Character.toString((char)i); System.out.println(str); } } }
Output:
A x b K s
Leave a Reply