Java tutorial
//package com.java2s; public class Main { public static String formatPhoneNumber(String mobile) { StringBuilder maskNumber = new StringBuilder(11); maskNumber.append(mobile.substring(0, 3)); maskNumber.append("****"); maskNumber.append(mobile.substring(7, mobile.length())); return maskNumber.toString(); } }