Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.math.BigDecimal;

public class Main {

    public static int getDurationToInt(long duration) {
        int d = 0;
        try {
            BigDecimal b = new BigDecimal(Long.toString(duration));
            BigDecimal one = new BigDecimal("1000");
            d = b.divide(one, 0, BigDecimal.ROUND_CEILING).intValue();
        } catch (Exception e) {
            e.printStackTrace();
            d = 0;
        }
        return d;
    }
}