Ai
1 Star 0 Fork 0

20175316盛茂淞/java-ceshi

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
MyCP.java 1.29 KB
一键复制 编辑 原始数据 按行查看 历史
20175316盛茂淞 提交于 2019-04-29 09:48 +08:00 . MyCP
import java.io.*;
public class MyCP {
public static void main(String[] args) throws IOException {
Scanner scan = new Scanner(System.in);
String str = scan.nextLine();
String[] Nstr = str.split(" ");
if (Nstr[2].equals("-tx")) {
FileReader reader = new FileReader(Nstr[3]);
FileWriter writer = new FileWriter(Nstr[4]);
dumptx(reader, writer);
}
if (Nstr[2].equals("-xt")) {
FileReader reader = new FileReader(Nstr[3]);
FileWriter writer = new FileWriter(Nstr[4]);
dumpxt(reader, writer);
}
}
public static void dumptx(FileReader reader, FileWriter writer) {
try (FileReader input = reader; FileWriter output = writer) {
char[] data = new char[1];
while ((input.read(data)) != -1) {
int da = (int) data[0];
String str1 = "";
String str = Integer.toBinaryString(da);
for (int i = 0; i < 8; i++) {
if (i < (8 - str.length())) str1 += '0';
}
str1 += str;
output.write(str1, 0, 8);
output.write(" ");
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/shengmaosong/java-ceshi.git
git@gitee.com:shengmaosong/java-ceshi.git
shengmaosong
java-ceshi
java-ceshi
master

搜索帮助