From Team CYMRU: http://www.team-cymru.org/Services/ip-to-asn.html

Maxmind ASNum: http://www.maxmind.com/app/asnum.

//The code to look up the ASN Number using Java. Upload the .dat file in the same folder.

import com.maxmind.geoip.*;
import java.io.IOException;

/* sample of how to use the GeoIP Java API with GeoIP Organization and
ISP databases */
/* This example can also be used with the GeoIP Domain and ASNum databases */
/* Usage: java OrgLookupTest 64.4.4.4 */

class OrgLookupTest {
public static void main(String[] args) {
try {
LookupService orgl = new LookupService(“GeoIPASNum.dat”);

System.out.println(“Organization: ” + orgl.getOrg(args[0]));
orgl.close();
}catch (IOException e) {
System.out.println(“IO Exception”); }

}
}