/** * @author lautturi.com * Java example: convert bytes [] to string in java */ import java.util.*; import java.nio.charset.StandardCharsets; public class Lautturi { public static void main(String[] args) { byte[] bytes = {104, 101, 108, 108, 111, 32, 108, 97, 117, 116, 116, 117, 114, 105}; String str = new String(bytes, StandardCharsets.UTF_8); System.out.println(str); } }
output:
hello lautturi