Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { public static int getProgressPercentage(long currentDuration, long totalDuration) { Double percentage; long currentSeconds = (int) (currentDuration / 1000); long totalSeconds = (int) (totalDuration / 1000); // calculating percentage percentage = (((double) currentSeconds) / totalSeconds) * 100; // return percentage return percentage.intValue(); } }