⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 encodetester.java

📁 这一些程序都是实验之用
💻 JAVA
字号:
import java.io.*;
public class EncodeTester{
	private static void readBuff(byte []buff)throws IOException{
		ByteArrayInputStream in=new ByteArrayInputStream(buff);
		int data;
		while((data=in.read())!=-1)
			System.out.print(data+" ");
			System.out.println();
			
			in.close();
}

public static void main(String args[])throws IOException{
	System.out.println("在内存中采用unicode字符编码");
	 char c='好';
	 int lowBit=c&0xff;
	 int highBit=(c&0xff00)>>8;
	 System.out.println(highBit+" "+lowBit);
	 
	 String s="好";
	 System.out.println("采用本地操作系统的默认字符编码");
	 readBuff(s.getBytes());
	 
	 System.out.println("采用GBK字符编码");
	 readBuff(s.getBytes("GBK"));
	 
	 System.out.println("采用标准UTF-8字符编码");
	 readBuff(s.getBytes("UTF-8"));
	 }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -