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 String normalizeHour(int hour) {
    if (hour == 0) {
        hour = 12;
    }
    return Integer.toString(hour);
}

From source file:Main.java

public static String unitFormat(int i) {
    String retStr = null;/*from   www  .  j ava  2 s.com*/
    if (i >= 0 && i < 10)
        retStr = "0" + Integer.toString(i);
    else
        retStr = "" + i;
    return retStr;
}

From source file:Main.java

private static String unitFormat(int i) {
    String retStr = null;/* w  w w. j a  v  a  2s. c  o m*/
    if (i >= 0 && i < 10)
        retStr = "0" + Integer.toString(i);
    else
        retStr = "" + i;
    return retStr;
}

From source file:Main.java

public static String getHourString(int hour) {
    if (hour == 0) {
        return "12";
    } else {/*from   w  w w .j a  v a  2 s.c  o m*/
        return Integer.toString(hour);
    }
}

From source file:Main.java

public static String humanizeTimeSpan(int minutes) {
    if (minutes < 30) {
        return Integer.toString(minutes) + " minutes";
    } else if (minutes < 45) {
        return "half an hour";
    } else if (minutes < 60) {
        return "45 minutes";
    } else if (minutes < 85) {
        return "an hour";
    } else if (minutes < 110) {
        return "an hour and a half";
    } else if (minutes < 24 * 60) {
        return Integer.toString((minutes + 10) / 60) + " hours";
    } else {//w  ww  . j a  v a  2 s. c om
        return Integer.toString(minutes / (60 * 24)) + " days";
    }
}

From source file:Main.java

@SuppressWarnings("unused")
static String ItoString(int[] ints) {
    String s = "";
    for (int g = 0; g < ints.length; g++) {
        s += Integer.toString(ints[g]) + " ";
    }//  ww w  .j a v  a2s .  c o m
    return s;
}

From source file:Main.java

public static String randNum(long dig, long len) {
    String number;//from   w  ww.jav a 2s  .c  o m
    int num = (int) Math.abs((Math.round(Math.random() * dig) + len));
    number = Integer.toString(num);
    return number;
}

From source file:Main.java

public static String getCurrentYear() {
    Calendar calendar = Calendar.getInstance();
    return Integer.toString(calendar.get(Calendar.YEAR));
}

From source file:Main.java

public static String dropDecimalIfRoundNumber(float val) {
    if (val == 0) {
        return "0";
    } else if (val % (int) val == 0) {
        return Integer.toString((int) val);
    } else {/*from ww  w  .j a v a  2 s  .  com*/
        return Float.toString(val);
    }
}

From source file:Main.java

public static String getFlushYear() {
    Calendar cal = Calendar.getInstance();
    int i = cal.get(Calendar.YEAR);
    String s = Integer.toString(i);
    return s;// www. j av  a 2  s  .  c o m
}