// The MX records returned will be in the format:
// <preference> domain.
// eg.
// 10 maila.microsoft.com.
String record = null;
MXRecord mxRecord = null;
String[] parsed = null;
records = new MXRecord[at.size ()];
for (int i = 0; i < at.size (); i++)
{
record = at.get (i).toString ();
parsed = record.split (" ");
if (parsed.length > 1)
{
mxRecord = new MXRecord ();
mxRecord.setPreference (Integer.parseInt (parsed[0]));
if (parsed[1].endsWith ("."))
{
parsed[1] = parsed[1].substring (0, parsed[1].length () - 1);
}
mxRecord.setAddress (InetAddress.getByName (parsed[1]));
records[i] = mxRecord;
}
else
{
throw new DNSException ("Error parsing MX record");