public void addInt(int var, int num, boolean reverse)
    {
        try
        {
        if(num == 2){
            int b1 = var & 0xff;
            int b2 = (var >> 8) & 0xff;

            if (!reverse)
            {
                byte[] varbyte = {(byte)b1,(byte)b2};
                this.packet += new String(varbyte,"ISO8859-1");
            }
            else
            {
                byte[] varbyte = {(byte)b2,(byte)b1};
                this.packet += new String(varbyte,"ISO8859-1");
            }

        } else if(num == 4){
            int b1 = var & 0xff;
            int b2 = (var >> 8) & 0xff;
            int b3 = (var >> 16) & 0xff;
            int b4 = (var >> 24) & 0xff;
            byte[] varbyte = {(byte)b1,(byte)b2,(byte)b3,(byte)b4};
            this.packet += new String(varbyte,"ISO8859-1");
        }
        }
        catch (Exception e) {
        }
    }