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

@HotSpotIntrinsicCandidate
public static String toString(int i) 

Source Link

Document

Returns a String object representing the specified integer.

Usage

From source file:Main.java

public static File findUnusedFilename(File saveDirectory, String name, String extension) {
    File file;//from w  w  w  . j  a  va2 s  . c  o m
    String str = "";
    int i = 0;
    do {
        file = new File(saveDirectory, name + str + extension);
        str = Integer.toString(i++);
    } while (file.exists());

    return file;
}

From source file:Main.java

public static String[] generateArrayWithStringValuesInRange(int min, int max) {
    ArrayList<String> arrayList = new ArrayList<>();
    for (int i = min; i < max; i++) {
        arrayList.add(Integer.toString(i));
    }// ww  w. ja  v  a 2 s . c  o m
    String[] stringArray = new String[arrayList.size()];
    for (int i = 0; i < arrayList.size(); i++) {
        stringArray[i] = arrayList.get(i);
    }
    return stringArray;
}

From source file:Main.java

public static Integer deleteItem(SQLiteDatabase db, Integer id) {
    return db.delete(TABLE_NAME, COLUMN_ID + " = ? ", new String[] { Integer.toString(id) });
}

From source file:Main.java

/**
 * Method setIntegerAttribute//from w  ww .  ja v  a 2s  .  c  om
 * 
 * @param element
 * @param attributeName
 * @param value
 */
public static void setIntegerAttribute(Element element, String attributeName, int value) {
    element.setAttribute(attributeName, Integer.toString(value));
}

From source file:Main.java

/**
 *
 * @param d eot in hours//from  w  ww .j a v  a 2 s . co m
 * @return formatted string
 */
public final static String eotToString(double d) {
    int m = (int) Math.floor(Math.abs(d) * 60d);
    int s = (int) Math.round((3600d * Math.abs(d)) - (m * 60d));
    return ((d > 0 ? "+" : "-") + Integer.toString(m) + "m" + Integer.toString(s) + "s");
}

From source file:Main.java

static String formatTwo(int num) {
    if (num <= 12) {
        return sTwoCharacterNumbers[num];
    } else//from ww w.j  av a2s.  c o m
        return Integer.toString(num);
}

From source file:Main.java

public static String getExtractDbFileName(int version) {
    //File format:race_v + DB_VERSION + _ + timestamp

    Long time = System.currentTimeMillis();
    String dateStr = new SimpleDateFormat("yyyyMMdd_kkmmss").format(time);
    return "Race_v" + Integer.toString(version) + "_" + dateStr;
}

From source file:Main.java

public static Integer deleteFilter(SQLiteDatabase db, Integer id) {
    return db.delete(TABLE_NAME, COLUMN_FILTER_ID + " = ? ", new String[] { Integer.toString(id) });
}

From source file:Main.java

public static List<String> GetNumbersList(int from, int to) {
    if (from > to) {
        return null;
    }/*from   ww w. j  a va  2s  .c  o  m*/

    List<String> numberList = new ArrayList<String>();

    for (int i = from; i <= to; i++) {
        numberList.add(Integer.toString(i));
    }

    return numberList;
}

From source file:Main.java

public static void putSumInClass(HashMap<String, Integer> suminclass, String text) {
    int i = 0, index;
    String info = text;//from   w w w  . j a va2 s. c om
    while ((index = info.indexOf("//@")) > 0) {
        i++;
        info = info.substring(index + 2);
    }
    if (suminclass.get(Integer.toString(i)) == null) {
        suminclass.put(Integer.toString(i), 1);
    } else {
        suminclass.put(Integer.toString(i), suminclass.get(Integer.toString(i)) + 1);
    }
}