Light Blue Pointer
본문 바로가기

Developing/개발일지53

2023-12-04, Today I Learned Spring 예외처리 방법 5가지 1) ResponseEntity 클래스를 사용 @Getter @AllArgsConstructor public class RestApiException { private String errorMessage; private int statusCode; } public ResponseEntity addFolders(@RequestBody FolderRequestDto folderRequestDto, @AuthenticationPrincipal UserDetailsImpl userDetails) { try { List folderNames = folderRequestDto.getFolderNames(); folderService.addFolders(folderNames, use.. 2023. 12. 4.
2023-11-30, Today I Learned 💡for 문으로 약수 구할때 뭔가 sqrt+1보다 ≤ sqrt가 정확하지 않을까 했는데 맞았다! ⚠️약수 구할때 제곱근까지만 for문 돌리고 싶으면 범위가 ≤sqrt여야 함 b) ? a - b : b - a; 2023. 11. 30.
2023-11-29, Today I Learned 오늘 생각한 것 코테 풀다가 어떤 문제에서 내가 정한 20분이라는 기준을 넘기고도 문제풀이가 엉망진창이라 패닉했다 이런 실력을 가지고 여태까지 왜 괜찮아하면서 살았을까, 더 노력했었어야 하는거 아닐까 하는 생각을 하는데 당연히 문제에 집중이 안 돼서 더 잘 풀릴리가 없다 그러다가 그냥 마음을 차분히 가라앉히고 나는 나의 최선을 다 하자 이런 생각을 하며 찬찬히 다시 살펴보니까 내가 어느 부분에서 실수했는지 보였고 코드를 정리해 나가니까 괜찮아졌고 코드 제출에도 성공했다 내가 개발자(취준생)으로 정신건강을 유지하며 살 수 있는 방법은 그냥 침착한 자세를 유지하면서 최선을 다 하는 것일 거라고 생각하게 되었다 그리고 오늘 저번에 공부한 내용이랑 겹치는 것이 많아서 Controller 테스트 할때 필터 내용 .. 2023. 11. 29.
2023-11-28, Today I Learned A. -1을 %하면 6이 나오지 않고 -1이 나온다 ⚠️-1을 %하면 -1이 나오니까 주의하자 return dayName[((days%7)-1)%7]; → int days = b-1 return dayName[days%7] 2023. 11. 28.
2023-11-23, Today I Learned ⭐Java array deep copy 쉽게 할 수 없을까 1. clone we’ll copy an array of primitive types using the clone method: int[] array = {23, 43, 55, 12}; int[] copiedArray = array.clone(); 2. stream String[] strArray = {"orange", "red", "green'"}; String[] copiedArray = Arrays.stream(strArray).toArray(String[]::new); ⭐Java Set import java.util.HashSet; HashSet cars = new HashSet(); cars.add("Volvo"); cars.contai.. 2023. 11. 24.
2023-11-22, Today I Learned ⭐Java String 값 비교 compareTo if string1 > string2, it returns positive number if string1 < string2, it returns negative number if string1 == string2, it returns 0 str1.compareTo(str3); ⭐Java max Math.max(2,5); Math.max임 2023. 11. 22.
2023-11-21, Today I Leanred ⭐Java square Math.pow(3, i) ⭐Java uppercase to lowercase String txt = "Hello World"; System.out.println(txt.toUpperCase()); System.out.println(txt.toLowerCase()); 2023. 11. 21.
2023-11-20, Today I Learned 오늘 배운 것 제곱근이 존재하는지 아닌지 원래 for문 돌려서 했는데 오늘 문득 sqrt를 쓰면 더 나을 거 같았음 ⭐Java 제곱근 sqaure root Math.sqrt(25); Math.sqrt() 메소드는 입력값과 출력값은 모두 double형이며 Math.sqrt(대상숫자)를 넣어주면 됩니다. ⭐Java 정수부 소수부 분리 double d = 123.456789555; // 소수의 정수부만 추출 int ip = (int) d; // 소수의 소수부만 추출 double fp = d - (int) d; // 출력 결과: 0.4567895550000003 💡소수부 == 0.0이면 제곱근 약수가 있는 수 ⭐Java String to char Array char[] chars = str.toCharArray.. 2023. 11. 20.
2023-11-17, Today I Learned 2023. 11. 17.