Java中byte[]、char[]和String的相互转化

//String to char[]

new String().toCharArray();


//String to byte[]
new String().getBytes();

new String().getBytes("GBK");


//char[] to String
new String(new char[]{});

Arrays.toString(new char[]{});


//byte[] to String
new String(new byte[]{});
new String(new byte[]{}, "GBK");
Arrays.toString(new byte[]{});

你可能感兴趣的:(java,String)