MAC : Java Glossary

The CurrCon Java Applet displays prices on this web page converted with today’s exchange rates into your local international currency, e.g. Euros, US dollars, Canadian dollars, British Pounds, Indian Rupees… CurrCon requires an up-to-date browser and Java version 1.8, preferably 1.8.0_102. If you can’t see the prices in your local currency, Troubleshoot. Use Firefox for best results.

MAC (Media Access Control) Huh? Every Ethernet LAN (Local Area Network) card has a unique 48-bit serial number, e.g. 00-0C-6E-27-4F-9B sometimes called its physical address. No other Ethernet and in the world has the same one unless they cheated. This physical address is usually just called the MAC , similar in function to the 32-bit IPv4 (Internet Protocol Version 4) or 128-bit IPv6 (Internet Protocol Version 6) IP addresses used on the Internet. Token Ring LAN cards don’t have a MAC. Though it is common to access the Internet via a small local Ethernet, some computers access the Internet via direct dialup and thus don’t necessarily have a MAC address.

The MAC is useful as a unique computer identifier for software protection schemes. Intel’s Pentium class machines have a unique serial number burned into their silicon that can also serve that purpose. AMD (Advanced Micro Devices) ’s do not.

In Java version 1.6 or later there is getHardwareAddress which will get you the hardware address of an adapter, usually the MAC. You need sufficient privilege to use it.

Here’s how to display a long MAC address in hex with the traditional dashes.

The code to extract the MAC in Windows in Java 1.5 or earlier is ugly, complicated, needs JNI (Java Native Interface) and an extra iphlpapi library DLL (Dynamic Link Library) not part of the normal Windows distribution. See this CodeGuru article. You can also find out what it is with the IPCONFIG utility. You could exec IPCONFIG and parse the output.

MAC (Message Authentication Code) are digital signatures used to verify that a piece of data originated with a given party and that it has not been tampered with. A MAC mechanism that is based on cryptographic hash functions is referred to as HMAC (Hashed Message Authentication Code). HMAC can be used with any cryptographic hash function, e.g., MD5 (Message Digest algorithm 5) or SHA-1 (Secure Hash Algorithm 1), in combination with a secret shared key. How HMACs (Hashed Message Authentication Codes) work is specified in  RFC 2104. JCE (Java Cryptography Extension) has support for HMAC-Md5 and HMAC-SHA1.

MAC (Apple Macintosh) (not all caps) refers to Apple’s line of computers, the MacIntosh, deliberately spelled differently from the McIntosh apple tree species after which it was named and McIntosh the maker of high end stereo equipment and presumably to avoid dealing with lawyers from that Scottish McFood company.

To ensure every device has a universally unique address, equipment manufacturers buy a range of 16.7 million addresses (24 bits worth) for $1600.00 USD from the IEEE (Institute of Electrical & Electronics Engineers). Then they hard burn one of these addresses into each device they manufacture.

Learning More

Oracle’s Javadoc on getHardwareAddress class : available:

This page is posted
on the web at:

Optional Replicator mirror
on local hard disk J:

Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

Your face IP:[]
You are visitor number