Here you can find the source of fromHexString(byte abyte0[], int i)
Parameter | Description |
---|---|
abyte0 | a parameter |
i | a parameter |
public static byte[] fromHexString(byte abyte0[], int i)
//package com.java2s; public class Main { /**//from ww w. j a v a2 s . co m * * * @param abyte0 * @param i * @return */ public static byte[] fromHexString(byte abyte0[], int i) { int j = 0; if (abyte0[0] == 48 && (abyte0[1] == 120 || abyte0[1] == 88)) { j += 2; i -= 2; } int k = i / 2; byte abyte1[] = new byte[k]; for (int l = 0; l < k;) { abyte1[l] = (byte) ((hexValueOf(abyte0[j]) << 4 | hexValueOf(abyte0[j + 1])) & 0xff); l++; j += 2; } return abyte1; } /** * * * @param i * @return */ public static int hexValueOf(int i) { if (i >= 48 && i <= 57) return i - 48; if (i >= 97 && i <= 102) return (i - 97) + 10; if (i >= 65 && i <= 70) return (i - 65) + 10; else return 0; } }