Example usage for java.lang Integer toString

List of usage examples for java.lang Integer toString

Introduction

In this page you can find the example usage for java.lang Integer toString.

Prototype

public String toString() 

Source Link

Document

Returns a String object representing this Integer 's value.

Usage

From source file:Main.java

public static String getRandomColor() {
    Random rand = new Random();
    Integer randomColor = Color.rgb(rand.nextInt(), rand.nextInt(), rand.nextInt());
    return randomColor.toString();
}

From source file:Main.java

/**
 * Puts the passed key and value into the map only if the value is not null.
 * /*from ww  w. j a  va 2  s  . c o m*/
 * @param map Map to add key and value to.
 * @param key Map key.
 * @param value Map value, if null will not be added to map.
 */
public static void nullSafePut(final Map<String, String> map, final String key, final Integer value) {
    if (value != null) {
        map.put(key, value.toString());
    }
}

From source file:Main.java

public static void setIntegerAttr(Element element, String name, Integer val) {
    if (val != null) {
        element.setAttribute(name, val.toString());
    }/*w  ww  . j  a  v a2 s.com*/
}

From source file:doc.action.SelectedDocsUtils.java

private static JnuDocument getDocument(Collection presidents, String selectedPresident) {
    for (Iterator iter = presidents.iterator(); iter.hasNext();) {
        JnuDocument doc = (JnuDocument) iter.next();
        Integer documentId = doc.getId();
        if (documentId.toString().equals(selectedPresident)) {
            return doc;
        }//from   w  ww . j  av a 2  s. c  om
    }
    return null;
}

From source file:com.aurel.track.item.action.ItemActionUtil.java

public static IPluginItemAction getPlugin(Integer actionID) {
    return getPlugin(getDescriptor(actionID.toString()).getTheClassName());
}

From source file:Main.java

public static String getDaysHoliday(Context context, int year, int month, int day) {
    if (holidayMap == null || holidayMap.size() <= 0) {
        return null;
    }/* w  w w.  ja  va  2  s  . c om*/

    Integer key = year * 10000 + month * 100 + day;
    String value = null;
    if (holidayMap.containsKey(key.toString())) {
        value = holidayMap.get(key.toString());
    }
    return value;
}

From source file:XSDDateTime.java

protected static String pad(int value) {

    Integer valueInt = new Integer(value);
    String valueString = valueInt.toString();
    if (valueString.length() == 1)
        valueString = "0" + valueString;
    return valueString;

}

From source file:Main.java

public synchronized static Long createId() {
    int max = 999;
    int min = 100;
    Random random = new Random();
    Integer s = random.nextInt(max) % (max - min + 1) + min;
    Long currentTimeMillis = System.currentTimeMillis();
    return Long.parseLong(currentTimeMillis.toString() + s.toString());
}

From source file:com.charandeepmatta.database.di.Schema.java

public static void createDatabase(final DataSource dataSource) throws IOException {
    JdbcTemplate jdbc = new JdbcTemplate(dataSource);
    updateSqlFromFile(jdbc, "base.sql");
    PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
    Integer i = 0;
    while (true) {
        i++;/*from  w w  w.ja  v a  2 s.  c o m*/
        Resource[] resources = resolver.getResources("classpath*:" + leftPad(i.toString(), 3, "0") + "_*.sql");
        if (resources.length == 0) {
            break;
        }
        updateSqlTo(jdbc, resources[0].getInputStream());
    }
}

From source file:Main.java

public static void setActiveAccountID(final Context context, final String accountName, final Integer userID) {
    SharedPreferences sp = getSharedPreferences(context);
    sp.edit().putString(makeAccountSpecificPrefKey(accountName, PREFIX_PREF_USER_ID), userID.toString())
            .apply();//  w w  w. j av  a 2 s  .co m
}