日期:2014-05-20 浏览次数:20722 次
package cn.com; import java.io.DataInputStream; import java.io.IOException; public class DataInputStreamTest { public static void main(String[] args) throws IOException { DataInputStream in = new DataInputStream(System.in); byte[] buf = new byte[1024]; int len = -1; String str =""; while((len = in.read(buf))!=-1){ str =new String(buf,0,len); for(int i=0;i<str.length()-2;i++){ System.out.println((int)str.charAt(i)); System.out.println(Integer.toHexString((int)str.charAt(i))); } } in.close(); } }