카테고리 없음2017. 10. 19. 18:18
반응형

public class ParseExam {

    

    public static void main(String[] args) {

        

        String numStr = "54";

        

        // String값을 int형의 값으로 바꾸는 방법

        int numInt = Integer.parseInt(numStr);

        System.out.println(numInt);

        

        // int형의 값을 String으로 바꾸는 방법

        String numStr2 = String.valueOf(numInt);

        System.out.println(numStr2);

    }


}

반응형
Posted by Dream Come True
IT/java2017. 10. 18. 00:14
반응형



자바 랜덤 숫자 발생 정렬 후 반환 



import java.util.Arrays;

import java.util.Random;



/**

 * Created by buster on 17. 9. 14.

 */



public class randomNum {


    public int[] lotArray(int input1, int input2) {


        int[] num = new int[input1];

        int lottoMax = input2;

        int MAX = input1;

        int xnum;

        int icount, j;



        Random rand = new Random();

//         로또 번호 발생 및  중복 제거


        for (icount = 0; icount < MAX; icount++) {

            xnum = rand.nextInt(lottoMax) + 1;

            num[icount] = xnum;

            for (j = 0; j < icount; j++) {

                if (num[icount] == num[j]) {

                    xnum = rand.nextInt(lottoMax) + 1;

                    num[icount] = xnum;

                    icount = icount - 1;

                    break;

                }

            }

        }

//   오름 차순으로  정렬 및 리턴 어레이 전달

        Arrays.sort(num);

        return num;

    }

}

반응형

'IT > java' 카테고리의 다른 글

java split() 문자 자르기  (684) 2017.10.27
자바 자문 자답 DecimalFormat 에러 발생  (627) 2017.10.21
Posted by Dream Come True
IT/android2017. 10. 15. 01:48
반응형

로딩시 화면 흰색 제거

와 화면 회전시 센서에의한 회전 과 내용 refresh 방지


AndroidManifest.xml


android:configChanges="orientation|screenSize"

android:screenOrientation="sensor">





styles.xml


 //로딩시 화면 흰색 제거

<item name="android:windowContentOverlay">@null</item>

<item name="android:windowIsTranslucent">true</item>


반응형
Posted by Dream Come True
IT/android2017. 10. 14. 13:31
반응형

DELETE_FAILED_INTERNAL_ERROR

Error while Installing APKs



File > Settings > Build, Execution, Deployment > Instant Run > Uncheck : Enable Instant Run

반응형
Posted by Dream Come True