Bitmap 이미지를 byte[] 로 가져 오거나 byte[] 을 Bitmap 으로 만드는 방법이다. //Bitmap -> Byte[]ByteArrayOutputStream bytearray = new ByteArrayOutputStream();ImageIO.write(image, "png", bytearray);byte[] b = bytearray.toByteArray(); public byte[] bitmapToByteArray( Bitmap bitmap ) { ByteArrayOutputStream stream = new ByteArrayOutputStream() ; bitmap.compress( CompressFormat.JPEG, 100, stream) ; byte[] byteArray = st..
■ byte배열(물론 사이즈는 4)을 int로 바꾸는 메소드?12345678public static int byte2Int(byte[] src) { int s1 = src[0] & 0xFF; int s2 = src[1] & 0xFF; int s3 = src[2] & 0xFF; int s4 = src[3] & 0xFF; return ((s1 >> 48) & 0xFF ); buf[2] = (byte)( (l >>> 40) & 0xFF ); buf[3] = (byte)( (l >>> 32) & 0xFF ); buf[4] = (byte)( (l >>> 24) & 0xFF ); buf[5] = (byte)( (l >>> 16) & 0xFF ); buf[6] = (byte)( (l >>> 8) & 0xFF ); b..
비트맵 -> 바이트배열 Bitmap image; // 변환시킬 비트맵 ByteArrayOutputStream stream = new ByteArrayOutputStream(); image.compress(CompressFormat.JPEG , 100 , stream); byte[] b = stream.toByteArray(); 바이트배열 - > 비트맵 byte[] imgBuf = data; // 변환시킬 바이트 배열 Bitmap image = BitmapFactory.decodeByteArray( imgBuf , 0 , imgBuf.length);