Welcome to the World of Online Learning:
Hello Friends “This blog helps you to learn Java programming concepts. You can learn Java language at your own speed and time. One can learn concepts of Java language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

Write a Java Program to Convert Milliseconds to Minutes and Seconds
PROGRAM: Java Program to Convert Milliseconds to Minutes and Seconds
/*Java Program to Convert Milliseconds to Minutes and Seconds*/
1: Milliseconds to Seconds/Minutes Using toMinutes() and toSeconds()
import java.util.concurrent.TimeUnit;
class Main {
public static void main(String[] args) {
long milliseconds = 1000000;
// us of toSeconds()
// to convert milliseconds to minutes
long seconds = TimeUnit.MILLISECONDS.toSeconds(milliseconds);
System.out.println(milliseconds + " Milliseconds = " + seconds + " Seconds");
// use of toMinutes()
// to convert milliseconds to minutes
long minutes = TimeUnit.MILLISECONDS.toMinutes(milliseconds);
System.out.println(milliseconds + " Milliseconds = " + minutes + " Minutes");
}
}
2: Milliseconds to Seconds/Minutes Using Mathematical Formula
class Main {
public static void main(String[] args) {
long milliseconds = 1000000;
long seconds = (milliseconds / 1000);
System.out.println(milliseconds + " Milliseconds = " + seconds + " Seconds");
long minutes = (milliseconds / 1000) / 60;
System.out.println(milliseconds + " Milliseconds = " + minutes + " Minutes");
}
}