/** * Sets the seconds part of the time. Note, if the seconds argument is 60 * or greater, the value will "wrap", and increase the minutes also. * * @param pSeconds an integer that should be between 0 and 59. */ public void setSeconds(int pSeconds) { time = getMinutes() * SECONDS_IN_MINUTE + pSeconds; }
String format(Time t) { // If minutes is more than digits long, simply return it if (t.getMinutes() >= Math.pow(10, digits)) { return Integer.toString(t.getMinutes()); } // Else return it with leading 0's //return StringUtil.formatNumber(t.getMinutes(), digits); return StringUtil.pad("" + t.getMinutes(), digits, "0", true); } }
/** * Creates a string representation of the time object. * The string is returned on the form m:ss, * where m is variable digits minutes and ss is two digits seconds. * * @return a string representation of the time object * @see #toString(String) */ public String toString() { return "" + getMinutes() + ":" + (getSeconds() < 10 ? "0" : "") + getSeconds(); }
/** * Sets the seconds part of the time. Note, if the seconds argument is 60 * or greater, the value will "wrap", and increase the minutes also. * * @param pSeconds an integer that should be between 0 and 59. */ public void setSeconds(int pSeconds) { time = getMinutes() * SECONDS_IN_MINUTE + pSeconds; }
/** * Sets the seconds part of the time. Note, if the seconds argument is 60 * or greater, the value will "wrap", and increase the minutes also. * * @param pSeconds an integer that should be between 0 and 59. */ public void setSeconds(int pSeconds) { time = getMinutes() * SECONDS_IN_MINUTE + pSeconds; }
/** * Sets the seconds part of the time. Note, if the seconds argument is 60 * or greater, the value will "wrap", and increase the minutes also. * * @param pSeconds an integer that should be between 0 and 59. */ public void setSeconds(int pSeconds) { mTime = getMinutes() * SECONDS_IN_MINUTE + pSeconds; }
String format(Time t) { // If minutes is more than mDigits long, simply return it if (t.getMinutes() >= Math.pow(10, mDigits)) { return Integer.toString(t.getMinutes()); } // Else return it with leading 0's //return StringUtil.formatNumber(t.getMinutes(), mDigits); return com.twelvemonkeys.lang.StringUtil.pad("" + t.getMinutes(), mDigits, "0", true); } }
String format(Time t) { // If minutes is more than digits long, simply return it if (t.getMinutes() >= Math.pow(10, digits)) { return Integer.toString(t.getMinutes()); } // Else return it with leading 0's //return StringUtil.formatNumber(t.getMinutes(), digits); return StringUtil.pad("" + t.getMinutes(), digits, "0", true); } }
String format(Time t) { // If minutes is more than digits long, simply return it if (t.getMinutes() >= Math.pow(10, digits)) { return Integer.toString(t.getMinutes()); } // Else return it with leading 0's //return StringUtil.formatNumber(t.getMinutes(), digits); return StringUtil.pad("" + t.getMinutes(), digits, "0", true); } }
/** * Creates a string representation of the time object. * The string is returned on the form m:ss, * where m is variable digits minutes and ss is two digits seconds. * * @return a string representation of the time object * @see #toString(String) */ public String toString() { return "" + getMinutes() + ":" + (getSeconds() < 10 ? "0" : "") + getSeconds(); }
/** * Creates a string representation of the time object. * The string is returned on the form m:ss, * where m is variable digits minutes and ss is two digits seconds. * * @return a string representation of the time object * @see #toString(String) */ public String toString() { return "" + getMinutes() + ":" + (getSeconds() < 10 ? "0" : "") + getSeconds(); }
/** * Creates a string representation of the time object. * The string is returned on the form m:ss, * where m is variable digits minutes and ss is two digits seconds. * * @return a string representation of the time object * @see #toString(String) */ public String toString() { return "" + getMinutes() + ":" + (getSeconds() < 10 ? "0" : "") + getSeconds(); }