private void constructmsg() {
        if (stringToInt(headerLength.getText()) < 8) {
            headerLength.setText("8");
        }

        msg = new int[stringToInt(headerLength.getText()) + 2];

        msg[0] = 0xfc;
        msg[1] = stringToInt(headerLength.getText());
        msg[2] = stringToInt(headerType.getText());
        msg[3] = stringToInt(headerDestination.getText());
        msg[4] = stringToInt(headerSource.getText());

        msg[6] = stringToInt(headerSeqHigh.getText());
        msg[7] = stringToInt(headerSeqLow.getText());
        msg[8] = stringToInt(headerChecksum.getText());
        msg[9] = 0xfd;

        int status = 0;

        if (headerFallDetected.isSelected()) {
            status |= 0x80;
        }
        if (headerSensorInUse.isSelected()) {
            status |= 0x40;
        }
        if (headerBatteryLow.isSelected()) {
            status |= 0x20;
        }
        if (headerCardFull.isSelected()) {
            status |= 0x10;
        }
        if (headerSignalLow.isSelected()) {
            status |= 0x08;
        }
        if (headerMessageMissed.isSelected()) {
            status |= 0x04;
        }
        if (headerOnMainPower.isSelected()) {
            status |= 0x02;
        }
        if (headerRequestTime.isSelected()) {
            status |= 0x01;
        }

        msg[5] = status;
    }