📄 hexstringparser.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: HexStringParser.java
package com.cmpp3_0.util;
import java.io.PrintStream;
public class HexStringParser
{
public HexStringParser()
{
}
public static byte[] HexStringToBytes(String hs)
{
if((hs.indexOf("0x") == 0 || hs.indexOf("0X") == 0) && hs.length() % 2 == 0)
{
hs = hs.substring(2);
int count = hs.length() / 2;
byte res[] = new byte[count];
for(int i = 0; i < count; i++)
{
String temp = hs.substring(0, 2);
byte t = (byte)Integer.parseInt(temp, 16);
res[i] = (byte)(t & 0xff);
res[i] = t;
hs = hs.substring(2);
}
return res;
} else
{
return null;
}
}
public static String byte2hex(byte b[])
{
String hs = "";
String stmp = "";
for(int n = 0; n < b.length; n++)
{
stmp = Integer.toHexString(b[n] & 0xff);
if(stmp.length() == 1)
hs = hs + "0" + stmp;
else
hs = hs + stmp;
}
hs = "0x" + hs.toUpperCase();
return hs;
}
public static void main(String args[])
{
String hexString = "0x0605041583158300480E011F07C00FC1F003E0F820FC20107E08041F044E03902700E409C07234016D9A6C59B6802C09B092446C22490D900890904400220909103C01E89E7E7917803C43E015208104A807C284100A40A502500821855008408102100AA1841008407E0210082143E0102000040807C230006018381806000C0D01800600600180B0";
byte temp[] = HexStringToBytes(hexString);
System.out.println(byte2hex(temp));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -