public static boolean isFileClass(String file) {

        byte[] magicNumber = {(byte) 0xCA, (byte) 0xFE, (byte) 0xBA, (byte) 0xBE};

        try (FileInputStream input = new FileInputStream(file)) {
            byte[] number = new byte[4];
            if (input.read(number) != -1){
                if (Arrays.equals(magicNumber, number))
                    return true;
                else
                    return false;
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return false;
    }