728x90 개발/java25 배열 초기화 선언 하기, 정렬하기 int nRandom[] = new int[6];정렬하기Arrays.sort(nRandom); 2018. 9. 5. 랜덤 번호 만들기 Random randomGenerator = new Random();int randomInteger = randomGenerator.nextInt(100); //0 ~ 99 사이의 int를 랜덤으로 생성 int randomIntegerUniform = randomGenerator.nextInt(); // int를 랜덤으로 생성 5-10사이 랜덤int start = 5;int end = 10;double range = end - start + 1;int randomInt5to10 = (int)(randomGenerator.nextDouble() * range + start); 2018. 9. 5. java int to String int to String int from = 123;String to = Integer.toString(from); 2018. 9. 5. java 오늘 날짜 구하고 포맷 형식 변경하기 Date today = new Date(); System.out.println(today); SimpleDateFormat date = new SimpleDateFormat("yyyy/MM/dd"); SimpleDateFormat time = new SimpleDateFormat("hh:mm:ss a"); System.out.println("Date: "+date.format(today)); System.out.println("Time: "+time.format(today)); 2018. 7. 15. 이전 1 ··· 3 4 5 6 7 다음 728x90