Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.text.TextUtils;

public class Main {

    public static String mixPhone(String phone) {
        if (phone == null || TextUtils.isEmpty(phone) || phone.length() != 11) {
            return "";
        }
        String prefix = phone.substring(0, 3);
        String suffix = phone.substring(7, 11);
        return prefix + "****" + suffix;
    }
}