public static boolean checkFileFormat(RandomAccessFile file) throws IOException { if (file.length() < Loader.MINIMUM_FILE_LENGTH) return false; byte[] magic = new byte[MAGIC_HEADER.length]; file.readFully(magic); if (!Arrays.equals(MAGIC_HEADER, magic)) return false; return true; }