[JAVA] int 또는 float 를 byte 배열 타입으로 변환. byte 배열을 int 또는 float 으로 변환, Unsigned 표현.
자주쓰는 함수라 매번 코딩하기 귀찮아서 올려 놓는다. 아래는 4개의 길이를 갖는 byte 배열을 int 로 바꾸거나 int 를 4개의 길이를 갖는 byte 배열로 바꾸는 것이다.// 아래의 방법 외에 다음과 같이 간단한 방법도 존재한다. :// byte[] byteArray = ByteBuffer.allocate(4).putInt(value).array(); public byte[] intToByteArray(int value) { byte[] byteArray = new byte[4]; byteArray[0] = (byte)(value >> 24); byteArray[1] = (byte)(value >> 16); byteArray[2] = (byte)(value >> 8); byteArray[3] = ..
개발 관련/Java
2014. 3. 4. 16:22
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- activity
- ENC28J60
- 이더넷
- 블루투스
- 알리익스프레스
- Java
- 부트로더
- ATtiny85
- NeoPixel
- 개발
- json
- ndk
- noidemcu
- 아두이노
- HC-06
- bluetooth
- WS2812B
- oled
- 병렬 프로그래밍
- 침블락
- 칩두이노
- Iot
- arduino
- Cheapduino
- 가습기
- ESP8266
- 안드로이드
- Android
- 스마트 무드등
- 안드로이드 개발
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 | 31 |
글 보관함