All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.samples.java.ex.CTU_Sample Maven / Gradle / Ivy

Go to download

An auxiliary findbugs.sourceforge.net plugin for java bug detectors that fall outside the narrow scope of detectors to be packaged with the product itself.

There is a newer version: 7.6.8
Show newest version
package ex;
import java.util.concurrent.TimeUnit;

public class CTU_Sample {

    public long simpleMillisAndNanos() {
        long millis = System.currentTimeMillis();
        long nanos = System.nanoTime();

        return millis + nanos;
    }

    public long badUseOfConvert() {
        long secs = TimeUnit.SECONDS.convert(1000, TimeUnit.MILLISECONDS);
        long millis = System.currentTimeMillis();

        return secs + millis;
    }

    public long fpHandConversions() {
        long millis = System.currentTimeMillis();
        long secs = TimeUnit.SECONDS.convert(1, TimeUnit.HOURS);

        return millis * 1000 + secs;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy