I'm guessing what you're up to ... given a URL
string, using an HttpURLConnection to get data from a web site? If so, see getResponseCode to detect a redirect. Codes in the 300s indicate a redirect was done. See
http://libraries.ucsd.edu/about/tools/http-response-codes.html or google for "http response code"
You need to know where you realy wound up, too. Maybe set followRedirect to false. Then when you get a 300 something, look through the actual HTML returned for a redirect header. I haven't tried this. Let me know if it works for you!