KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > util > BytesHelper


1 //$Id: BytesHelper.java,v 1.2 2004/09/26 03:17:21 oneovthafew Exp $
2
package org.hibernate.util;
3
4 public final class BytesHelper {
5
6     private BytesHelper() {}
7
8     public static int toInt( byte[] bytes ) {
9         int result = 0;
10         for (int i=0; i<4; i++) {
11             result = ( result << 8 ) - Byte.MIN_VALUE + (int) bytes[i];
12         }
13         return result;
14     }
15     
16 }
17
18
19
20
21
22
23
Popular Tags