Byte.parseByte(s.substring(0,2), 16);
等等

解决方案 »

  1.   

    public class TestByte
    {
        public static void main(String[] args) {
            String s="2F3412A2";
            byte[] p = new byte[s.length()/2];
            for(int i=0;i<p.length;i++)
            {
                int t=Integer.parseInt(s.substring(i*2,i*2+2),16);
                p[i] = (byte) t;
            }
            for(int i=0;i<p.length;i++)
                System.out.print(p[i]+" ");
        }}