Java tutorial
//package com.java2s; public class Main { /** * Builds String output of time in the style of: hrs H mins M * * @param millis * @return */ public static String buildCardViewStyleTime(int millis) { return String.valueOf(calcHours(millis)) + "H " + String.valueOf(calcRemainderMins(millis)) + "M"; } /** * Calculates whole hours from millisecond input * * @param millis * @return */ public static int calcHours(int millis) { return convertToTotalMinutes(millis) / 60; } /** * Calculates remaining minutes (ie. <60mins) from millis input * */ public static int calcRemainderMins(int millis) { return convertToTotalMinutes(millis) % 60; } /** * Calculates total minutes from millisecond input * * @param millis * @return */ public static int convertToTotalMinutes(int millis) { return (millis / (1000 * 60)); } }