Java regular Mac address adds a colon:

Record the method of adding a colon to the regular Mac address in Java. I always have to find it. Why not take notes?

String s = "112233445566".replaceAll("(\\w{2})(?!$)", "$1:");
System.out.println(s);

Guess you like

Origin blog.csdn.net/baoolong/article/details/128418180