code: public static int getBOMType(byte[] bytes, int length)
      {
          for (int i = 0; i < BOMBYTES.length; i++)
          {
              for (int j = 0; j < length && j < BOMBYTES[i].length; j++)
              {
                  if (bytes[j] != BOMBYTES[i][j])
                  {
                      break;
                  }
                  if (bytes[j] == BOMBYTES[i][j] && j == BOMBYTES[i].length - 1)
                  {
                      return i;
                  }
              }
          }
          return NONE;
      }
docs: <p>getBOMType.</p>
  
  @param bytes an array of byte.
  @param length a int.
  @return a int.