byte[] buf = new byte[4]; buf[0] = 'R'; buf[1] = 'a'; buf[2] = 'r'; buf[3] = 'e'; String str = new String(buf); System.out.println(str); StringBuffer sb = new StringBuffer(str); sb.setCharAt(0, 'r'); buf = sb.toString().getBytes(); System.out.println(new String(buf));