Java

Java ํ”„๋กœ๊ทธ๋žจ ์ˆ˜ํ–‰ ์‹œ๊ฐ„ ์ธก์ •

๋…ธ๋ฃจ๋ฃฝ 2020. 9. 2. 21:00

์ œ๋Œ€๋กœ ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ์ž‘์„ฑํ•˜๊ณ  ์žˆ๋Š”์ง€ ์ฒดํฌํ•˜๊ธฐ ์œ„ํ•ด์„œ ์•Œ๊ณ ๋ฆฌ์ฆ˜์˜ ์†Œ์š” ์‹œ๊ฐ„์„ ํ™•์ธํ•ด์•ผ ํ•œ๋‹ค.

์‹ค์ œ ํ”„๋กœ๊ทธ๋žจ์˜ ์ˆ˜ํ–‰ ์‹œ๊ฐ„์„ ์ธก์ •ํ•˜๋Š” ๊ฒƒ์€ ์•Œ๊ณ ๋ฆฌ์ฆ˜์˜ ํšจ์œจ์„ฑ์„ ์ธก์ •ํ•˜๋Š” ๊ฐ€์žฅ ๊ธฐ๋ณธ์ ์ธ ๋ฐฉ๋ฒ•!!

 

sleep๋ฉ”์†Œ๋“œ์—์„œ 1000 = 1์ดˆ

		/* ์‹œ์ž‘ ์‹œ๊ฐ„ */
		long start_time = System.currentTimeMillis();
		
		
		/* 1์ดˆ ๋Œ€๊ธฐ */
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}

		
		/* ์ข…๋ฃŒ ์‹œ๊ฐ„ */
		long end_time = System.currentTimeMillis();

		System.out.println( "Time: " + ( end_time - start_time )/1000.0 );