Iterator i = response.getHeaders().entrySet().iterator(); Map.Entry entry; int count = 1; do { if (!i.hasNext()) { return null; } entry = (Map.Entry) i.next(); count++; } while (count <= index); return (String) entry.getValue();
return response.getHeaders().getHeaderValue(index - 1);
  public String getHeaderField(int index)  {    if (!connected)      {        try          {            connect();          }        catch (IOException e)          {            return null;          }      }    if (index == 0)      {        return getStatusLine(response);      }    Iterator i = response.getHeaders().entrySet().iterator();    Map.Entry entry;    int count = 1;    do      {        if (!i.hasNext())          {            return null;          }        entry = (Map.Entry) i.next();        count++;      }    while (count <= index);    return (String) entry.getValue();  }