account Id Masking by **** - Java Security

Java examples for Security:Password

Description

account Id Masking by ****

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        String accountId = "java2s.com";
        System.out.println(accountIdMasking(accountId));
    }/*from  w  w w.  jav a 2 s .c  o m*/

    public static String accountIdMasking(final String accountId) {
        String maskAccountId = accountId;

        if (accountId.length() <= 4) {
            maskAccountId = "****" + accountId;
        } else {
            maskAccountId = "****" + accountId.substring(4);
        }
        return maskAccountId;
    }
}

Related Tutorials