Java Integer Format format(int ticks)

Here you can find the source of format(int ticks)

Description

format

License

Open Source License

Declaration

public static String format(int ticks) 

Method Source Code

//package com.java2s;

public class Main {
    private static final StringBuilder SB = new StringBuilder(11);

    public static String format(int ticks) {
        int hours = ticks / 216000;
        int minutes = ticks / 3600 % 60;
        int seconds = ticks / 60 % 60;
        int frames = ticks % 60;
        SB.setLength(0);/*from  www .ja  va2 s . co  m*/
        if (hours < 10) {
            SB.append('0');
        }
        SB.append(hours);
        SB.append(':');
        if (minutes < 10) {
            SB.append('0');
        }
        SB.append(minutes);
        SB.append(':');
        if (seconds < 10) {
            SB.append('0');
        }
        SB.append(seconds);
        SB.append(':');
        if (frames < 10) {
            SB.append('0');
        }
        SB.append(frames);
        return SB.toString();
    }
}

Related

  1. format(int i, int length, boolean left_justify, char fill)
  2. format(int intval)
  3. format(int num)
  4. format(int num, int length)
  5. format(int spaces, String string)
  6. formatInt(int i, int radix, int len)
  7. formatInt(int in, int precision)
  8. formatInt(int myint, int maxint)
  9. formatINT(int n)