일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- architecture
- 제이쿼리
- springboot+redis
- 엔티티 코드 치환
- Linux
- 정규식
- docker 컨테이너로 띄우기
- 만들면서 배우는 클린 아키텍처
- redis + spring boot 함께
- 초단위
- Docker Compose
- Stack
- 자바
- Java
- 리눅스
- js
- Tomcat
- 톰캣
- insert
- jQuery
- Entity Code 치환
- select
- mysql
- javascript
- 특수문자 치환
- aws elasticache 활용
- for문
- sftp
- catalina.out
- 자바스크립트
- Today
- Total
목록Java (26)
꾸준하게, 차근차근

1. For문 public static void main(String[] args) { List list = Arrays.asList(1,2,3,4,4,5,5,6); int[] arr = new int[list.size()]; for( int i=0; i

1. SFTP 전송시 필요한 정보 User Ip User Port User Id User Password Upload Path 2. sendSFTP 메소드 구현 public void sendSftp(HashMap map) { try { String originFileName = (String) map.get("fileName"); String zipFileName = originFileName.substring(0, originFileName.lastIndexOf(".")) + ".zip"; String sftpIp = configService.getConfigValue("IP"); int sftpPort = Integer.parseInt(configService.getConfigValue("PORT")..

1. maven dependency 설정 net.lingala.zip4j zip4j 1.3.3 zip4j는 람다표현식을 포함하고 있다. 람다표현식은 java 1.8에서 구현되기 때문에 개발환경을 1.8로 설정해주어야 한다. 2. Zipper.java import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.zip.ZipException; import net.lingala.zip4j.core.ZipFile; import net.lingala.zip4j.model.ZipParameters; import net.lingala.zip4j.util.Zip4jConstants; public class Zipper ..

1. Set public static void main(String[] args) { List list = Arrays.asList(1,2,3,4,4,5,5,6); Set set = new HashSet(list); System.out.println(list.size()); System.out.println(set.size()); if( list.size() != set.size() ) { System.out.println("배열 내 중복 요소 존재"); } } Set은 중복을 허용하지 않는 자료구조이다. 리스트를 Set으로 변환한 후 두 객체의 사이즈를 비교하여 사이즈가 일치하지 않는다면 리스트 내 중복 요소가 존재하고 있는 것입니다. 2. Stream.distinct() public static vo..

1. for문 - 반복문을 통해 배열의 요소를 순회, 요소와 key값을 하나씩 비교하며 key값과 일치하는 값이 존재하는지 확인한다. public void solutionFor() { int[] lottos = {44, 1, 0, 0, 31, 25}; int[] win_nums = {31, 10, 45, 1, 6, 19}; int prize_count = 0; for( int lotto : lottos ) { for( int win_num : win_nums ) { if( lotto == win_num ) { prize_count++; break; } } } System.out.println(Math.min(7-prize_count, 6)); } 2. binarySearch() - 이진탐색 메서드를 사용..

1. 대표적인 패턴 패턴 의미 x 문자 x xyz 문자 xyz [xyz] x,y,z 중 하나의 문자 [a-z] a~z 중 하나의 문자 [^xyz] x,y,z가 아닌 하나의 문자 [^a-z] a~z가 아닌 하나의 문자 abc|xyz 문자열 abc 또는 xyz {숫자} 반복 횟수 ^x 시작문자 x x$ 종료문자 x . 하나의 문자 x* 0개이상 계속되는 x \ 다음에 오는 문자를 이스케이프 처리 \d 숫자 0~9 \D 숫자가 아닌 문자 = [^0-9] \W 영문, 숫자, 언더바 = [A-za-zo-9_] \s 공백문자(스페이스, 탭, 줄바꿈 등) \S 공백문자 이외의 문자 = [^\s] \t 수평탭 \n 줄바꿈 코드 2. 참고사항 1. ^ -> 시작표시(매칭이 처음부터 되어야 함) 2. $ -> 끝표시(문자..

public static int timeToSec(String time) { String[] times = time.split(":"); int hours = Integer.parseInt(times[0]); int minutes = Integer.parseInt(times[1]); int seconds = Integer.parseInt(times[2]); int totalSeconds = (+hours) * 60 * 60 + (+minutes) * 60 + (+seconds); return totalSeconds; }

public static String secToTime(int time) { int hours = (int) Math.floor(times / 3600); int minutes = (int) Math.floor((times - (hours * 3600)) / 60); int seconds = (int) Math.floor((times - (hours * 3600) - (minutes * 60))); String hoursStr = String.valueOf(hours); String minutesStr = String.valueOf(minutes); String secondsStr = String.valueOf(seconds); if (hours < 10) {hoursStr = "0" + hours;} ..