?? main.java
字號:
import java.io.*;
// Second half first
class Main {
public static void main(String[] args) {
if (args.length != 1) {
System.err.println("Usage: java Main <inputfile>");
System.exit(-1);
}
try {
File f = new File(args[0]);
BufferedReader in = new BufferedReader(new FileReader(f));
if (!in.markSupported()) {
System.err.println("Mark not supported");
System.exit(-1);
}
long limit = f.length(); // get file size
// create mark for size of file
in.mark((int)limit);
// first copy; read just before EOF
in.skip(limit/2);
char[] buf = new char[(int)(limit/2)+1];
int howmany = in.read(buf);
PrintWriter out = new PrintWriter(System.out, true);
out.write(buf, 0, howmany);
// reset to beginning of file
in.reset();
howmany = in.read(buf, 0, (int)limit/2);
out.write(buf, 0, howmany);
out.flush();
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -