How to initialize byte array with ASCII codes in Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
        byte[] array = { 97, 98, 99, 100 };
        
        String s = new String(array);
        
        System.out.println(s);
    }
}



/*
run:

abcd

*/

 



answered Nov 3, 2020 by avibootz

Related questions

...