package com.android.socket.server;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.io.FileUtils;
public class Java {
public static void main(String[] args) {
// 十六进制文本用eclipse转换可执行文件方法
System.out.println("开始转码");
onGet();
System.out.println("转码完成");
}
public static void onGet(){
try {
String hello = FileUtils.readFileToString(new File("C:\\Users\\Administrator\\Desktop\\111.txt"));
List<Byte> b = new ArrayList<Byte>();
for (String bbb : hello.split(" ")) {
b.add((Byte) (byte) (int) (Integer.parseInt(bbb, 16) & 0xFF));
}
byte[] bbbb = new byte[b.size()];
for (int i = 0; i < bbbb.length; i++)
bbbb[i] = b.get(i);
FileUtils.writeByteArrayToFile(new File("C:\\Users\\Administrator\\Desktop\\111.exe"), bbbb);
} catch (Exception e) {
System.out.println("转码异常");
}
}
}
十六进制文本用eclipse转换可执行文件方法
要用到jar包:commons-io-2.4.jar
http://download.csdn.net/detail/qq_21051503/8956897
找不到的请留言,邮箱