public String convertToPrintFriendlyString(String phiString) {
        if (null == phiString) {
            return NULL_REPLACEMENT_VALUE;
        } else if (phiString.isEmpty()) {
            return EMPTY_REPLACEMENT_VALUE;
        }

        int conversionLength = (logPhiMaxBytes > 0) ? Integer.min(phiString.length(), logPhiMaxBytes) : phiString.length();

        StringBuilder builder = new StringBuilder(conversionLength + STRING_BUFFER_PAD_SIZE);

        for (int i = 0; i < conversionLength; ++i) {
            appendCharacterAsPrintFriendlyString(builder, phiString.charAt(i));
        }

        return builder.toString();
    }
@Test
    public void testConvertToPrintFriendlyStringWithPhiMaxBytes() {
        Hl7Util local = new Hl7Util(3, LOG_PHI_TRUE);
        String result = local.convertToPrintFriendlyString(TEST_MESSAGE);
        assertEquals("MSH", result);
    }