1. 나머지는 배열의 인덱스를 활용할 것.
https://wellohorld.tistory.com/12
[백준 3052번] 나머지 - Java //Wello Horld//
백준 알고리즘 3052번 나머지를 Java로 풀어보자 총 10개의 수를 입력받고 그 수들을 42로 나누고 남은 나머지가 중복 되는지 체크하면 되는 문제다. 정답율이 70%가 넘는 아주 쉬운 문제이므로, 쉽게 쉽게 풀어..
wellohorld.tistory.com
2. ArrayList에 객체 생성해서 값 입력하고 값의 여부 확인
[자바] ArrayList에 객체를 생성해서 값을 입력.
이미 답변이 달려있어서 여기에 올림. 질문) http://kin.naver.com/qna/detail.nhn?d1id=1&dirId=1040201&docId=254134528 내 답변) 1. CLASS import java.util.ArrayList; import java.util.Scanner; public clas..
jethihmm.tistory.com
https://mainia.tistory.com/2323
[Java] 자바 리스트(List,ArrayList) 이용하는 방법
[Java] 자바 리스트(List,ArrayList) 이용하는 방법 환경 : Eclipse Mars, Android 4.2.2 이번에는 자바 리스트 클래스들에 대해 알아 보겠습니다. 리스트는 배열의 한계 때문에 만들어진 자료형 입니다. 배열을..
mainia.tistory.com
ArrayList<Integer> list = new ArrayList<Integer>();
list.add(3);
boolean b = list.contains(3); // b는 true
3. Array 값 존재 유무 확인
https://jjeong.tistory.com/1250
[Java] Array Value 존재 유무 확인하기
생각 나지 않을때가 많아서 퍼왔습니다. Originanl Source) http://www.programcreek.com/2014/04/check-if-array-contains-a-value-java/ public static boolean useList(String[] arr, String targetValue) { re..
jjeong.tistory.com
1) list 활용
Arrays.asList(arr).contains(targetValue);
2) set 활용
Set<Integer> set = new HashSet<Integer>(Arrays.asList(arr));
return set.contains(targetValue);
3) array binarysearch 활용
Arrays.sort(arr); // 반드시 먼저 사용할 것
int a = Arrays.binarySearch(arr, targetValue);
// a가 양수면 true, 음수면 false
3. 문자를 아스키코드값으로 내보낼 때 그냥 캐스팅하면 된다.
https://stackoverflow.com/questions/16458564/convert-character-to-ascii-numeric-value-in-java
Convert character to ASCII numeric value in java
I have String name = "admin"; then I do String char = name.substring(0,1); //char="a" I want to convert the char to its ASCII value (97), how can I do this in java?
stackoverflow.com