Java中ASC码与字符互相转换

每一个字符都会有对应的ASCII码,下面举例在Java中将两者互相转换:
		String a = "asd";
		char[] ch = a.toCharArray();
		for (int i = 0; i < ch.length; i++) {
			int backnum = (int) ch[i];
			System.out.println("ch"+ch[i]+":" + backnum);
			char strChar = (char) backnum; 
			System.out.println("strChar :" +strChar);
		}



你可能感兴趣的:(java)