Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String floatToDuration(String duration_in_float) {
        duration_in_float = String.format("%2.2f", Float.parseFloat(duration_in_float));
        String[] parts = duration_in_float.split("\\.");
        long minute = Long.parseLong(parts[0]);
        long seconds = (60 * Long.parseLong(parts[1])) / 100;
        return String.format("%02d:%02d", minute, seconds);
    }
}