日期:2014-05-20 浏览次数:20851 次
public class ByteArrayToUnicodeHighLow
{
public static void main(String[] args) throws Exception
{
//高位在前,低位在后,可直接转
//
byte[] origin = {108,95};//108-->6c; 95-->5f
String unicodeString = new String(origin,"unicode");
System.out.println(unicodeString);
}
}
/*
* 江
*/
public class ByteArrayToUnicodeHighLow1
{
public static void main(String[] args) throws Exception
{
//高位在前,低位在后,数组前加两个字节ff,fe也可以。
//
byte[] origin = {-2,-1,108,95};//-2-->fe; -1-->ff; 108-->6c; 95-->5f
String unicodeString = new String(origin,"unicode");
System.out.println(unicodeString);
}
}
/*
* 江
*/
public class ByteArrayToUnicodeLowHigh
{
public static void main(String[] args) throws Exception
{
//低位在前,高位在后,不可直接转,直接转出现错误.
//
byte[] origin = {95,108};// 95-->5f; 108-->6c;
String unicodeString = new String(origin,"unicode");
System.out.println(unicodeString);