| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 | 31 |
- Eclipse
- IntelliJ
- 단위테스트
- 테스트자동화
- math
- 자바문법
- junit5
- string
- Array
- js
- HashMap
- 인텔리제이
- javascript
- java테스트
- 스프링부트
- Java
- html
- junit
- 배열
- 정규식
- input
- ArrayList
- 문자열
- list
- Visual Studio Code
- 자바
- CSS
- 자바스크립트
- SpringBoot
- vscode
- Today
- Total
목록2025/12/14 (2)
어제 오늘 내일
Math.hypot(x, y)는 피타고라스의 정리를 이용해 √(x² + y²) 값을 계산해 줍니다.직각삼각형에서 두 변의 길이가 주어졌을 때 빗변 길이를 바로 구할 수 있습니다. 1. 기본 사용법public class MathHypotBasic { public static void main(String[] args) { System.out.println(Math.hypot(3, 4)); // 5.0 System.out.println(Math.hypot(5, 12)); // 13.0 }}Math.sqrt(x*x + y*y)와 동일한 결과를 주지만, hypot()은 오버플로우나 언더플로우에 더 안전합니다. 2. 음수 입력public class MathHypotNegativ..
자바 Math 클래스는 각도 단위를 변환할 수 있는 두 가지 유틸리티 메소드를 제공합니다. toDegrees(radians) → 라디안(radian)을 도(degree)로 변환 toRadians(degrees) → 도(degree)를 라디안(radian)으로 변환 삼각함수 메소드는 모두 라디안을 사용하므로, 각도 기반 계산 시 자주 활용됩니다. 1. toDegrees() – 라디안을 도 단위로 변환public class MathToDegrees { public static void main(String[] args) { double rad = Math.PI / 2; // π/2 라디안 double deg = Math.toDegrees(rad); System...