字符串转换成字节数组后能转回来的吗? char[] cs = "abcd".toCharArray();String nString = new String(cs); ?? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 中文应该没有问题啊!试试下面的程序就知道了. String x="你发了吗abc?"; char[] cs = x.toCharArray(); for(int i = 0; i < cs.length; i++) System.out.print("=="+cs[i]); System.out.println(); char ch = cs[0]; cs[0]=cs[3];cs[3]=ch; ch=cs[1]; cs[1]=cs[2];cs[2]=ch; for(int i = 0; i < cs.length; i++) System.out.print("=="+cs[i]); System.out.println(); String x_new = new String(cs); System.out.println("new string="+x_new); byte[] cs = "中文".getBytes();String nString = new String(cs); 没问题呀?package test1;public class Test1 { public static void main(String[] args){ String wux=new String("我爱我的祖国abc?"); char[] charArray=wux.toCharArray(); for(int i=0;i<charArray.length;i++){ System.out.println(charArray[i]); } System.out.println(); String hjl=new String(charArray); System.out.println(hjl); } } 事件监听器问题 swing如何做圆边? 求这个帖子的地址 jxl表格字体问题 删除远程的一个文件或文件夹 反转一个字符串 为何两个相同的String,比较结果却是False?? 【UML的问题】在交互图里鼠标事件应该如何建模? 读取SYBASE数据库出现的奇怪问题?读取字符数据时只能读出258个字节来! 为什么我的HTMLConverter不能用,DOS一闪就没有了 int to char有没有这样的方法? 请教高手:如何获取类中某一个方法中的值??
String x="你发了吗abc?";
char[] cs = x.toCharArray();
for(int i = 0; i < cs.length; i++)
System.out.print("=="+cs[i]);
System.out.println();
char ch = cs[0];
cs[0]=cs[3];cs[3]=ch;
ch=cs[1];
cs[1]=cs[2];cs[2]=ch;
for(int i = 0; i < cs.length; i++)
System.out.print("=="+cs[i]);
System.out.println(); String x_new = new String(cs);
System.out.println("new string="+x_new);
byte[] cs = "中文".getBytes();
String nString = new String(cs);
package test1;public class Test1 { public static void main(String[] args){
String wux=new String("我爱我的祖国abc?");
char[] charArray=wux.toCharArray();
for(int i=0;i<charArray.length;i++){
System.out.println(charArray[i]);
}
System.out.println();
String hjl=new String(charArray);
System.out.println(hjl); } }