4,817 questions
HI @Dondon510 ,
You can try this simple way.
str.substring(0, 5) +
str.substring(5, str.length() - 3)
.replaceAll("[\\d]", "x") +
str.substring(str.length() - 3, str.length());