public static String bitvector_to_hex(BitVector bv) { String binary = ""; for (int i = 0; i < bv.size(); i++) { if (bv.getBit(i)) binary += "1"; else binary += "0"; } return binary_to_hex(binary); }
public static BitVector hex_to_bitvector(String hex) { String ff = hex_to_binary(hex); BitVector bv = new BitVector(ff.length()); for (int i = 0; i < ff.length(); i++) { Boolean val = false; if (ff.charAt(i) == '1') val = true; bv.setBit(i, val); } return bv; }