public static byte[] baToHexBytes(byte[] ba) {
        byte[] hb = new byte[ba.length * 2];
        for (int i = 0; i < ba.length; i++) {
            byte upper = (byte) ((ba[i] & 0xf0) >> 4);
            byte lower = (byte) (ba[i] & 0x0f);
            hb[2 * i] = toHexChar(upper);
            hb[2 * i + 1] = toHexChar(lower);
        }
        return hb;
    }
@Test
    public void testbaToByte() throws Exception {
        assertEqualsArray(new byte[]{}, JOrphanUtils.baToHexBytes(new byte[]{}));
        assertEqualsArray(new byte[]{'0', '0'}, JOrphanUtils.baToHexBytes(new byte[]{0}));
        assertEqualsArray("0f107f8081ff".getBytes(StandardCharsets.UTF_8),
                JOrphanUtils.baToHexBytes(new byte[]{15, 16, 127, -128, -127, -1}));
    }