Working with java.net
This class returns the local IP and hostname.

import java.net.InetAddress;
import java.net.UnknownHostException;
 
public class IpHost {
   
    InetAddress myAddr;
   
    public String getIp(){
        try{
            myAddr = InetAddress.getLocalHost();
            return myAddr.getHostAddress();
        }catch (UnknownHostException e){
            return e.toString();
        }
    }
   
    public String getHost(){
        try{
            myAddr = InetAddress.getLocalHost();
            return myAddr.getHostName();
        }catch (UnknownHostException e){
            return e.toString();
        }
    }
 
}

see ya…😀