// Detect It Easy: detection rule file
// Author: horsicq <horsicq@gmail.com>

meta("format", "Microstation Java (JMDL) Compiled Class");

function detect() {
    if (Binary.getSize() >= 8 && Binary.compare("CAFEBEEF")) {
        // var nMinor = X.U16(4,_BE);
        var nMajor = X.U16(6, _BE);
        if (nMajor) {
            sVersion = "JDK ";
            switch (nMajor) {
                case 0x2D:
                    sVersion += "1.1";
                    break;
                case 0x2E:
                    sVersion += "1.2";
                    break;
                case 0x2F:
                    sVersion += "1.3";
                    break;
                case 0x30:
                    sVersion += "1.4";
                    break;
            }

            bDetected = nMajor >= 0x2D && nMajor <= 0x42;
        }
    }


    sLang = "Java";

    return result();
}
