<p>How do I get the physical addresses of my machine in <strong>Java</strong>?</p>

```
```
try {
    InetAddress addr = InetAddress.getLocalHost();

    // Get IP Address
    byte[] ipAddr = addr.getAddress();

    // Get hostname
    String hostname = addr.getHostName();
} catch (UnknownHostException e) {
}
```
```