Android examples for android.telephony:Phone Number
encrypt Phone Num with ****
import android.annotation.SuppressLint; import android.text.TextUtils; import android.util.Log; import java.math.BigDecimal; import java.text.DecimalFormat; import java.util.Locale; public class Main{ public static String encryptPhoneNum(String card) { if (null == card || "".equals(card)) { return ""; }/*w ww . j av a 2 s .co m*/ int Length = card.length(); if (Length < 3 + 4) { return card; } card = card.substring(0, 3) + "****" + card.substring(Length - 4, Length); return card; } }