Java tutorial
//package com.java2s; public class Main { public static String convertLoginName(String acNo) { if (isEmpty(acNo)) return null; return acNo.substring(0, 2) + "****" + acNo.substring(acNo.length() - 2, acNo.length()); } public static boolean isEmpty(String value) { if (value == null || "".equals(value.trim())) return true; return false; } }