code: public static HadoopVersion getVersion(byte[] historyFileContents) {
      if(historyFileContents.length > HADOOP2_VERSION_LENGTH) {
        // the first 10 bytes in a hadoop2.0 history file contain Avro-Json
        String version2Part =  new String(historyFileContents, 0, HADOOP2_VERSION_LENGTH);
        if (StringUtils.equalsIgnoreCase(version2Part, HADOOP2_VERSION_STRING)) {
          return HadoopVersion.TWO;
        }
      }
      // throw an exception if we did not find any matching version
      throw new IllegalArgumentException(" Unknown format of job history file: " + historyFileContents);
    }
docs: determines the verison of hadoop that the history file belongs to
  
  @return
  returns 1 for hadoop 1 (pre MAPREDUCE-1016)
  returns 2 for newer job history files
  (newer job history files have "AVRO-JSON" as the signature at the start of the file,
  REFERENCE: https://issues.apache.org/jira/browse/MAPREDUCE-1016? \
  focusedCommentId=12763160& \ page=com.atlassian.jira.plugin.system
  .issuetabpanels:comment-tabpanel#comment-12763160
  
  @throws IllegalArgumentException if neither match