package jiami;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.util.Arrays;
public class test {
public static void main(String[] args) {
byte[] sss = new byte[] { 106, 63, 56, 34, -29, 65, -22, 115, 34, -32, -110, -59, 121, -77, 99, -32, -25, 4, 109, -88 };
String appKey = new String(new byte[]{ 106, 63, 56, 34, -29, 65, -22, 115, 34, -32, -110, -59, 121, -77, 99, -32, -25, 4, 109, -88 });
String appKey2= new String(new byte[]{ -10, 85, 72, 66, 35, -120, -95, -29, 96, -120, -5, 75, 106, 84, -31, -11, 93, -114, -43, -125});
String appKey3= new String(new byte[]{ 102, 115, 49, 50, 51, 102, 100, 115, 97});//fs123fdsa
setwenjian(new byte[]{ -58, 118, -36, -29, 66, -53, 20, 52, -82, 125, -46, -49, 1, 9, -53, 125, -60, 21, 37, -115},"1.txt");
setwenjian(new byte[]{ 106, 63, 56, 34, -29, 65, -22, 115, 34, -32, -110, -59, 121, -77, 99, -32, -25, 4, 109, -125},"2.txt");
setwenjian(new byte[]{ -10, 85, 72, 66, 35, -120, -95, -29, 96, -120, -5, 75, 106, 84, -31, -11, 93, -114, -43, -125},"3.txt");
setwenjian(new byte[]{ 106, 63, 56, 34, -29, 65, -22, 115, 34, -32, -110, -59, 121, -77, 99, -32, -25, 4, 109, -88},"4.txt");
Object[] ob = new Object[] { Arrays.toString((byte[])sss)};
//Arrays.toString(arrayOfByte);
String s = "";//String变量
s = appKey2;
byte b[] = s.getBytes();//String转换为byte[]
b = new byte[]{ -125};
b = new byte[]{ -88};
b = new byte[]{ -10};
String t = new String(b);//bytep[]转换为String
System.out.println(Arrays.toString(b));
System.out.println(t);
//
System.out.println(ob);
System.out.println(appKey);
System.out.println(appKey2);
System.out.println(appKey3);
System.out.println("=========================");
try {
wenjian();
} catch (IOException e) {
e.printStackTrace();
}
}
public static void setwenjian(byte bt[],String flie){
File file = new File("d:/360WiFi", flie);
try {
file.createNewFile(); // 创建文件
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// 向文件写入内容(输出流)
String str = "亲爱的小南瓜!";
//
byte bt[] = new byte[20];
//
bt = str.getBytes();
try {
FileOutputStream in = new FileOutputStream(file);
try {
in.write(bt, 0, bt.length);
in.close();
// boolean success=true;
System.out.println("写入文件成功");
System.out.println(new String(bt));
} catch (IOException e) {
e.printStackTrace();
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void wenjian() throws IOException{
FileReader fr = new FileReader("C:\\Users\\admin\\Desktop\\新建文本文档 (2).txt");
int ch = 0;
while((ch = fr.read())!=-1 )
{
System.out.print((char)ch);
}
fr = new FileReader("C:\\Users\\admin\\Desktop\\新建文本文档 (2).txt");
ch = 0;
while((ch = fr.read())!=-1 )
{
System.out.print(ch);
System.out.print(",");
}
}
}