Java Utililty Methods Second Parse

List of utility methods to do Second Parse

Description

The list of methods to do Second Parse are organized into topic(s).

Method

intcentisecondsPerTick(final int tps)
Change tps to number of centiseconds per tick, 100/tps.
return 100 / tps;
doubleparseHHMMSSToSeconds(String txt)
parse HHMMSS To Seconds
if (txt.length() == 0)
    return 0;
String[] tim = txt.split(":");
if (tim.length == 1)
    return Double.parseDouble(tim[1]);
else if (tim.length == 2)
    return Integer.parseInt(tim[0], 10) * 60 + Double.parseDouble(tim[1]);
else if (tim.length == 3)
...
intparseSeconds(String value, int defaultValue)
Returns value as a positive integer, or 0 if it is negative, or defaultValue if it cannot be parsed.
try {
    long seconds = Long.parseLong(value);
    if (seconds > Integer.MAX_VALUE) {
        return Integer.MAX_VALUE;
    } else if (seconds < 0) {
        return 0;
    } else {
        return (int) seconds;
...
intparseTimeStringAsSeconds(String timeString)
parse Time String As Seconds
int seconds;
String[] timeComponents = timeString.split(":");
if (timeComponents.length == 0) {
    seconds = 0;
} else if (timeComponents.length == 1) {
    seconds = Integer.parseInt(timeComponents[0]) * 60;
} else if (timeComponents.length == 2) {
    int minutes = 0;
...
DateparseW3CDateWithFractionalSeconds(String dateString)
parse WC Date With Fractional Seconds
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US);
Date d = sdf.parse(dateString);
return d;