From within your code that is running on the client?
InetAddress.getByName("hostname").getHostAddress();
will get any host's IP address
or
InetAddress.getLocalHost().getHostAddress();
will give you the local host's IP address (loopback IP).
both give a string representation of the IP address