package arithmetic; import java.util.Scanner; import org.junit.Test; public class Test02 { /** * 输入一个秒数,要求转换为XX小时XX分XX秒的格式输出出来; */ @Test public void changeFormat(){ Scanner scanner = new Scanner(System.in); System.out.println("请输入秒数"); int second = scanner.nextInt(); int hour = second/3600; int minute = second%3600/60; int sec = second%60; System.out.println(hour+"时"+minute+"分"+sec+"秒"); } }