private double getDouble(int format, int offset) {
        switch (format) {
            case FMT_SBYTE:
                return data[offset];
            case FMT_BYTE:
                int iValue = data[offset];
                return iValue & 0xFF;
            case FMT_USHORT:
                return get16u(offset);
            case FMT_ULONG:
                return get32u(offset);
            case FMT_URATIONAL:
            case FMT_SRATIONAL:
                int num = get32s(offset);
                int den = get32s(offset + 4);
                if (den == 0) return 0;
                else return (double) num / (double) den;
            case FMT_SSHORT:
                return get16s(offset);
            case FMT_SLONG:
                return get32s(offset);
            default:
                return 0.0;
        }
    }