Java tutorial
//package com.java2s; //License from project: LGPL import java.util.Set; import android.text.TextUtils; public class Main { private final static String keyBaseName = "taintinfo"; private static String generateKeyNameForTaintInfo(Set<String> allIntentKeys) { String keyName = keyBaseName; int counter = 0; for (String intentKey : allIntentKeys) { if (intentKey.startsWith(keyBaseName)) { String possibleNumber = intentKey.substring(keyBaseName.length()); if (possibleNumber.length() > 0 && TextUtils.isDigitsOnly(possibleNumber)) { int currentCounter = Integer.parseInt(possibleNumber); counter = currentCounter + 1; } } } if (counter != 0) keyName += counter; return keyName; } }