masking a creditcard number in java
问题 I tried to mask the characters in a creditcard number string using character 'X'.I wrote two functions as below .The second function uses commons.lang.StringUtils class .I tried to find the time it takes in both cases public static String maskCCNumber(String ccnum){ long starttime = System.currentTimeMillis(); int total = ccnum.length(); int startlen=4,endlen = 4; int masklen = total-(startlen + endlen) ; StringBuffer maskedbuf = new StringBuffer(ccnum.substring(0,startlen)); for(int i=0;i