public static String getMacAddress() {
		try {
			String mac = null;

			for (NetworkInterface ni : Collections.list(NetworkInterface
					.getNetworkInterfaces())) {
				if (ni.getHardwareAddress() != null) {
					byte[] hwAddr = ni.getHardwareAddress();
					if (hwAddr.length > 0) {
						mac = "";
						for (int i = 0; i < hwAddr.length; i++) {
							mac += String.format("%02X%s", hwAddr[i],
									(i < hwAddr.length - 1) ? ":" : "");
						}
						break;
					}
				}
			}

			return mac;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}