find adress from ip code example

Example 1: how to find ip address

import java.net.InetAddress;
import java.net.UnknownHostException;
public class FindIPaddress {
	public static void main(String[] args) throws UnknownHostException {
		InetAddress a = InetAddress.getLocalHost();
		System.out.println(a.getHostAddress());	
	}
}

Example 2: ip lockup

$ curl "https://api.ip2location.com/v2/?ip=182.1.74.0&key={YOUR_API_KEY}&package=WS24&addon=continent,country,region,city,geotargeting,country_groupings,time_zone_info"

{
    "country_code": "ID",
    "country_name": "Indonesia",
    "region_name": "Jawa Timur",
    "city_name": "Surabaya",
    "latitude": "-7.24917",
    "longitude": "112.75083",
    "zip_code": "60135",
    "time_zone": "+07:00",
    "isp": "PT Telekomunikasi Selular Indonesia",
    "domain": "telkomsel.com",
    "net_speed": "DSL",
    "idd_code": "62",
    "area_code": "031",
    "weather_station_code": "IDXX0052",
    "weather_station_name": "Surabaya",
    "mcc": "510",
    "mnc": "10",
    "mobile_brand": "Telkomsel",
    "elevation": "6",
    "usage_type": "MOB",
    "credits_consumed": 33,
    "continent": {
        "name": "Asia",
        "code": "AS",
        "hemisphere": [
            "south",
            "east"
        ],
        "translations": []
    },
    "country": {
        "name": "Indonesia",
        "alpha3_code": "IDN",
        "numeric_code": "360",
        "demonym": "Indonesians",
        "flag": "https:\/\/cdn.ip2location.com\/assets\/img\/flags\/id.png",
        "capital": "Jakarta",
        "total_area": "1904569",
        "population": "266794980",
        "currency": {
            "code": "IDR",
            "name": "Indonesian Rupiah",
            "symbol": "Rp"
        },
        "language": {
            "code": "ID",
            "name": "Indonesian"
        },
        "idd_code": "62",
        "tld": "id",
        "translations": []
    },
    "region": {
        "name": "Jawa Timur",
        "code": "08",
        "translations": []
    },
    "city": {
        "name": "Surabaya",
        "translations": []
    },
    "geotargeting": {
        "metro": "602"
    },
    "country_groupings": [
        {
            "acronym": "APAC",
            "name": "Asia-Pacific"
        },
        {
            "acronym": "APEC",
            "name": "Asia-Pacific Economic Cooperation"
        },
        {
            "acronym": "ASEAN",
            "name": "Association of Southeast Asian Nations"
        },
        {
            "acronym": "CIVETS",
            "name": "Central and Eastern Europe"
        },
        {
            "acronym": "CPLP",
            "name": "Community of Portuguese Language Countries"
        },
        {
            "acronym": "G20",
            "name": "Group of Twenty"
        },
        {
            "acronym": "G77",
            "name": "Group of 77"
        },
        {
            "acronym": "MIKTA",
            "name": "Mexico, Indonesia, Republic of Korea, Turkey and Australia"
        },
        {
            "acronym": "MINT",
            "name": "Mexico, Indonesia, Nigeria, and Turkey"
        },
        {
            "acronym": "RCEP",
            "name": "Regional Comprehensive Economic Partnership"
        },
        {
            "acronym": "SEA",
            "name": "South-East Asia"
        },
        {
            "acronym": "UN",
            "name": "United Nations"
        },
        {
            "acronym": "VISTA",
            "name": "Vietnam, Indonesia, South Africa, Turkey and Argentina"
        }
    ],
    "time_zone_info": {
        "olson": "Asia\/Jakarta",
        "current_time": "2021-02-07T19:31:49+07:00",
        "gmt_offset": 25200,
        "is_dst": "no",
        "sunrise": "05:31",
        "sunset": "17:54"
    }
}