public String findMsh18(byte[] hl7Message, Charset charset) {
        String answer = "";

        if (hl7Message != null && hl7Message.length > 0) {

            List<Integer> fieldSeparatorIndexes = findFieldSeparatorIndicesInSegment(hl7Message, 0);

            if (fieldSeparatorIndexes.size() > 17) {
                int startOfMsh19 = fieldSeparatorIndexes.get(16) + 1;
                int length = fieldSeparatorIndexes.get(17) - fieldSeparatorIndexes.get(16) - 1;

                if (length > 0) {
                    answer = new String(hl7Message, startOfMsh19, length, charset);
                }
            }
        }

        return answer;
    }
@Test
    public void testFindMsh18WhenExistsWithTrailingPipe() {
        final String testMessage = MSH_SEGMENT + "||||||8859/1|" + '\r' + REMAINING_SEGMENTS;

        assertEquals("8859/1", hl7util.findMsh18(testMessage.getBytes(), charset));
    }