我如何|
从我的偶数/奇数条件中删除最后一个?
例子:
import java.io.*;
import java.net.Socket;
public class Test {
public static String _noManualTraceIt = "0008e07cd8ec6cfdb900283508004500004a7d8d400080060000c0a80087c0a800c6c6931388956304704eebd50c5018ffff82da0000674500000504000000000000030000000000000000000000060000000000ff210000";
public static void main(String[] args) throws IOException {
System.out.println( wireShirk(_noManualTraceIt) );
}
public static byte[] wireShirk(String bytes) throws IOException {
String temp = "";
String replaceIfOnLastFound = "||&|\r\n|\n\r|etc|etc";
int _i = 0;
do {
temp += bytes.charAt(_i);
if(_i%2 ==0) {
} else {
temp += "|";
}
System.out.println(bytes.length() + " " + _i + " " + two.charAt(_i) + " " + temp);
_i++;
} while(_i<bytes.length());
bytes = temp; // << replaceIfOnLastFound any of those characters
// | or & or \r\n or etc etc from that variable
String byteArrayStr[] = bytes.split("\\|");
byte bytesArray[] = new byte[byteArrayStr.length];
for (int i = 0; i < byteArrayStr.length; ++i) {
bytesArray[i] = (byte) (Integer.parseInt(byteArrayStr[i], 16));
}
return bytesArray;
}
}
输出:
176 175 0 00|08|e0|7c|d8|ec|6c|fd|b9|00|28|35|08|00|45|00|00|4a|7d|8d|40|00|80|06|00|00|c0|a8|00|87|c0|a8|00|c6|c6|93|13|88|95|63|04|70|4e|eb|d5|0c|50|18|ff|ff|82|da|00|00|67|45|00|00|05|04|00|00|00|00|00|00|03|00|00|00|00|00|00|00|00|00|00|00|06|00|00|00|00|00|ff|21|00|00|