본문 바로가기

전체 글192

Java Stream - FileOutputStream package lec08.fileio04.second.stream.d; import java.awt.Desktop; import java.io.File; import java.io.FileOutputStream; public class FileOutputStreamTest { public static void main(String[] args) { FileOutputStream fileOutputStream = null; try { fileOutputStream = new FileOutputStream("C:\\~~~.txt"); fileOutputStream.write((int) 'E'); fileOutputStream.write((int) 'a'); fileOutputStream.write((int).. 2022. 11. 13.
Java Stream - UseByteArray //텍스트 파일을 byte 크기 별로 불러오기 package lec08.fileio04.second.stream.c; import java.io.FileInputStream; public class UseByteArray { public static void main(String[] args) { FileInputStream fileInputStream = null; try { fileInputStream = new FileInputStream("C:\\Users\\~~~.txt"); byte[] bytes = new byte[8]; while (true) { int read = fileInputStream.read(bytes); if (read == -1) { break; } String getData.. 2022. 11. 13.
Java Stream - FileReader vs FileInputStream java.io.fileReader - Character 파일을 읽을 수 있는 기능으로 인코딩 방식이 지정 가능하다. java.io.FileInputStream - 파일로부터 바이트를 입력 받아 바이트 단위로 출력할 수 있는 클래스이다. 따라서 다양한 타입의 파일을 읽어올 수 있다. //FileReader vs InputStream package lec08.fileio04.second.stream.b; import java.io.FileInputStream; import java.io.FileReader; public class FileInputStreamTest { public static void main(String[] args) { FileInputStream fileInputStream = nul.. 2022. 11. 13.
Java Stream - Incoding & Decoding String Incoding / Decoding package lec08.fileio04.second.stream.a; import java.util.Arrays; public class IncodingDecodingMain { public static void main(String[] args) throws Exception { String strData = "한국"; byte[] defaultBytes = strData.getBytes(); byte[] ms949Bytes = strData.getBytes("MS949"); byte[] utf8Bytes = strData.getBytes("UTF-8"); byte[] euckrBytes = strData.getBytes("EUC-KR"); System.. 2022. 11. 13.
1. Java 셋팅 1. Open JDK 설치 https://github.com/ojdkbuild/ojdkbuild GitHub - ojdkbuild/ojdkbuild: Community builds using source code from OpenJDK project Community builds using source code from OpenJDK project - GitHub - ojdkbuild/ojdkbuild: Community builds using source code from OpenJDK project github.com 1.8.0 version msi 추천 - 시스템 속성 / 고급 / 환경 변수 편집을 무려! 자동으로 해준다 Custom Setup은 따로 건드릴거 없다 2. Eclipse 설치 Ecli.. 2022. 11. 10.
0. Java란? 들어가기 앞서 원래 Python과 Django가 좋아서 웹 프로그래밍에 입문하게 되었는데 취업을 Java를 활용하는 회사로 하여 새로운 공부를 하게 되었다. 새로운 로드맵과 함께 공부를 함에 있어서 Python과 Django 때의 실수를 안하고자 한다. 내가 공부하고 있는게 무엇인지, 왜 공부하는지 파악을 우선시 하겠다. Java? Java는 처음부터 객체 지향 언어로 개발된 프로그램이다. Java는 UNIX 기반의 배경을 가지고 있어 문법적 특징은 C언어와 비슷하다. Java와 다른 컴파일 언어의 구분점은 Java의 컴파일 코드가 플랫폼 독립적이란 것이다. Java 컴파일러는 바이트코드로 변환하고 바이트코드를 JVM(Java Virtual Machine, 자바 가상 머신)으로 실행한다. JVM은 운영체.. 2022. 11. 10.
프로그래머스 / 영어 끝말잇기 / 파이썬 def solution(n, words): list_ = [words[0]] for i in range(1, len(words)): if words[i-1][-1] != words[i][0]: return [i%n +1, i//n+1] if words[i] in list_: return [i%n +1, i//n+1] list_.append(words[i]) return [0,0] 2022. 10. 6.
프로그래머스 / 짝지어 제거하기 / 파이썬 def solution(s): right = [] for i in s: if len(right) == 0: right.append(i) elif right[-1] == i: right.pop() else: right.append(i) if right: return 0 return 1 2022. 10. 6.
프로그래머스 / 다음 큰 숫자 / 파이썬 def ChangeAndCount(n): a = "" while n > 1: a += str(n % 2) n = n//2 a += "1" return a.count("1") def solution(n): num_1 = ChangeAndCount(n) while True: n = n+1 if ChangeAndCount(n) == num_1: return n 2022. 9. 20.