This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
That's actually 2 different things. There are ways to get the tower ID, but I don't know of a standard Java API for that.
On the other hand, there is a JSR spec for location and a lot of devices implement it. The normal process is that the location service uses a process called trilateralization to triangulate location to within a fairly small distance (I forget if it's 1000m or 1000ft) for my carrier, though. That's done by referencing multiple tower.
The JSR location service allows multiple inputs, so if your phone has GPS capabilities and you required GPS-level precision, it will return that data. The actual mechanisms are transparent to the application.
An IDE is no substitute for an Intelligent Developer.