Java (2) 썸네일형 리스트형 [Copy&Paste]String 다루기 byte[] to String byte[] ={'a','b',}; String str = new String(data, StandardCharsets.UTF_8); byte[] ={'a','b',}; String str = new String(data); String.toCharArray() String str = "abcdefg"; char [] array = str.toCharArray(); String.getBytes(); String str= "Hello"; byte buff[] = str.getBytes(); //charset byte buff1[] = str.getBytes(StandardCharsets.UTF_8); //charset string try { byte buff2[] = str... Singleton class 설계 유용하면서 간단한 디자인패턴 : 싱글톤 패턴 Singleton class Basic type public class Singleton { private volatile static Singleton uniqueInstance = null; private Singleton() {} public static Singleton getInstance (){ if ( uniqueInstance == null){ synchronized( Singleton.class){ if (uniqueInstance == null) uniqueInstance = new Singleton(); } } return uniqueInstance; } } 이전 1 다음