Java: byte[] と String の相互変換 Java における byte[] と String の相互変換 String から byte[] へ String str = "Hello"; byte[] bytes = str.getBytes("UTF-8"); 12 String str = "Hello";byte[] bytes = str.getBytes("UTF-8"); byte[] から String へ Java byte[] bytes = {72, 101, 108, 108, 111}; String str = new String(bytes, "UTF-8"); 12 byte[] bytes = {72, 101, 108, 108, 111};String str = new String(bytes, "UTF-8");