Java tutorial
//package com.java2s; import android.text.TextUtils; public class Main { public static String getStarMobile(String phoneNumber) { if (TextUtils.isEmpty(phoneNumber) || phoneNumber.length() < 11) { return ""; } StringBuilder builder = new StringBuilder(); builder.append(phoneNumber.subSequence(0, 3)); builder.append("****"); builder.append(phoneNumber.subSequence(7, 11)); return builder.toString(); } }