@Override
    public byte[][] split(byte[] message) {
        if (!isSplitRequired()) {
            byte[] nliMessage = new byte[UDHIE_NLI_SINGLE_MSG_HEADER_REAL_LENGTH + message.length];
            nliMessage[0] = (byte) UDHIE_NLI_SINGLE_MSG_HEADER_LENGTH;
            nliMessage[1] = (byte) UDHIE_NLI_IDENTIFIER;
            nliMessage[2] = (byte) UDHIE_NLI_HEADER_LENGTH;
            nliMessage[3] = this.languageIdentifier;
            System.arraycopy(message, 0, nliMessage, 4, message.length);
            return new byte[][] { nliMessage };
        }

        int segmentLength = getSegmentLength();

        // determine how many messages
        int segmentNum = message.length / segmentLength;
        int messageLength = message.length;
        if (segmentNum > MAX_SEG_COUNT) {
            // this is too long, can't fit, so chop
            segmentNum = MAX_SEG_COUNT;
            messageLength = segmentNum * segmentLength;
        }
        if ((messageLength % segmentLength) > 0) {
            segmentNum++;
        }

        byte[][] segments = new byte[segmentNum][];

        int lengthOfData;
        byte refNum = getReferenceNumber();
        for (int i = 0; i < segmentNum; i++) {
            logger.debug("segment number = {}", i);
            if (segmentNum - i == 1) {
                lengthOfData = messageLength - i * segmentLength;
            } else {
                lengthOfData = segmentLength;
            }
            logger.debug("Length of data = {}", lengthOfData);

            segments[i] = new byte[UDHIE_NLI_MULTI_MSG_HEADER_REAL_LENGTH + lengthOfData];
            logger.debug("segments[{}].length = {}", i, segments[i].length);

            segments[i][0] = UDHIE_NLI_MULTI_MSG_HEADER_LENGTH; // doesn't include itself, is header length
            // SAR identifier
            segments[i][1] = UDHIE_IDENTIFIER_SAR;
            // SAR length
            segments[i][2] = UDHIE_SAR_LENGTH;
            // DATAGRAM REFERENCE NUMBER
            segments[i][3] = refNum;
            // total number of segments
            segments[i][4] = (byte) segmentNum;
            // segment #
            segments[i][5] = (byte) (i + 1);

            // national language locking shift table, element identifier
            segments[i][6] = (byte) UDHIE_NLI_IDENTIFIER;
            segments[i][7] = (byte) UDHIE_NLI_HEADER_LENGTH;
            segments[i][8] = this.languageIdentifier;

            // now copy the data
            System.arraycopy(message, i * segmentLength, segments[i], UDHIE_NLI_MULTI_MSG_HEADER_REAL_LENGTH, lengthOfData);
        }
        return segments;
    }
@Test
    public void splitTurkishShortMessageWith155Character() {
        String message = "12345678901234567890123456789012345678901234567890123456789012345678901234567890"
                         + "123456789012345678901234567890123456789012345678901234567890123456789012345"; // 155 single message

        byte turkishLanguageIdentifier = 0x01;
        SmppSplitter splitter = new SmppNLSTSplitter(message.length(), turkishLanguageIdentifier);
        SmppSplitter.resetCurrentReferenceNumber();
        byte[][] result = splitter.split(message.getBytes());

        assertEquals(1, result.length);
        assertArrayEquals(
                new byte[] {
                        SmppNLSTSplitter.UDHIE_NLI_SINGLE_MSG_HEADER_LENGTH, SmppNLSTSplitter.UDHIE_NLI_IDENTIFIER,
                        SmppNLSTSplitter.UDHIE_NLI_HEADER_LENGTH, turkishLanguageIdentifier,
                        49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54,
                        55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48,
                        49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54,
                        55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53,
                        54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49,
                        50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48,
                        49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53 },
                result[0]);
    }