Use HexFormat instead of home-grown formatting
[mdsal.git] / model / ietf / ietf-type-util / src / main / java / org / opendaylight / mdsal / model / ietf / util / Ipv6Utils.java
index c5e94e829257385af5b9785dd6a64aaa36db9a21..f2ba8c82f01f3271682aaddf20d63b6506526cb2 100644 (file)
@@ -11,6 +11,7 @@ import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Verify.verify;
 
 import java.util.Arrays;
+import java.util.HexFormat;
 import org.eclipse.jdt.annotation.NonNull;
 
 /**
@@ -112,8 +113,7 @@ final class Ipv6Utils {
              * the regexp has already verified that we are not being fed
              * anything bigger than 0xffff between the separators.
              */
-            final int chval = AbstractIetfYangUtil.hexValue(ch);
-            val = val << 4 | chval;
+            val = (val << 4) + HexFormat.fromHexDigit(ch);
             haveVal = true;
         }