public class ShowChinese {
public static void main(String[] args) throws IOException {
FileInputStream fis = new FileInputStream("点招面试题总结.java");
byte[] by = new byte[1024];
int len;
int count = 0;
byte mid = 0;
String str;
while ((len = fis.read(by)) != -1) {
if (count == 1) {
byte[] midby = new byte[by.length + 1];
midby[0] = mid;
for (int i = 0; i < by.length; i++) {
midby[i + 1] = by[i];
}
by = midby;
count = 0;
}
int num = 0 ;
for (int i = by.length - 1;i>=0;i--) {
if (by[i]<0) {
num++;
}else {
break;
}
}
if (num % 2 == 1) {
str = new String(by, 0, by.length - 1);
count++;
mid = by[by.length - 1];
} else {
str = new String(by, 0, len);
}
System.out.print(str);
}
}
}
|
|