(자바) Unsigned int 다루기

  1. public class UnsignedUtil {   
  2.     public static int byte2uchar(byte b) {   
  3.         return (int) (b & 0xff);   
  4.     }   
  5.   
  6.     public static byte uchar2byte(int c) {   
  7.         return (byte) (c & 0xff);   
  8.     }   
  9.   
  10.     public static int short2ushort(short s) {   
  11.         return (int) (s & 0xffff);   
  12.     }   
  13.   
  14.     public static short ushort2short(int s) {   
  15.         return (short) (s & 0xffff);   
  16.     }   
  17.   
  18.     public static long int2uint(int i) {   
  19.         return (long) (i & 0xffffffffL);   
  20.     }   
  21.   
  22.     public static int uint2int(long i) {   
  23.         return (int) (i & 0xffffffffL);   
  24.     }   

댓글

이 블로그의 인기 게시물

(네트워크)폴링방식 vs 롱 폴링방식

(ElasticSearch) 결과에서 순서 정렬

(18장) WebSocekt과 STOMP를 사용하여 메시징하기