public String getEncryptedString(String fieldValue) { String encryptedFieldValue = null; int i = fieldValue.indexOf("*"); if (i != -1) { String[] fldValueArray = fieldValue.split("\\*"); for (int j = 0; j < fldValueArray.length; j++) { try { encryptedFieldValue = encrypt(fldValueArray[j]) + "*"; } catch (EncryptionException e) { // TODO Handle it e.printStackTrace(); } } } else { try { encryptedFieldValue = encrypt(fieldValue); } catch (EncryptionException e) { // TODO Handle it e.printStackTrace(); } } return encryptedFieldValue; }