feat: opt code
This commit is contained in:
@@ -191,13 +191,13 @@ public class Main {
|
||||
}
|
||||
|
||||
private static byte[] string2Bytes(String str) {
|
||||
int len = str.length();
|
||||
final int len = str.length();
|
||||
if ((len % 2) != 0) {
|
||||
throw new RuntimeException("String format error: " + str);
|
||||
}
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
for (int i = 0; i < len; i++) {
|
||||
String substr = new String(new char[]{str.charAt(i++), str.charAt(i)});
|
||||
final String substr = new String(new char[]{str.charAt(i++), str.charAt(i)});
|
||||
baos.write((byte) Integer.parseInt(substr, 16));
|
||||
}
|
||||
return baos.toByteArray();
|
||||
|
||||
Reference in New Issue
Block a user