Convertir un tableau d’octet en un tableau de int

Author:

 java, table
Download

public class Tab_Conversion
 {
 
   /*
   * La fonction reçoit un tableau
   * d'octet en paramètre et retourne
   * un tableau de int comme valeur
   */
    public static int[] byte2int(byte[]byte_Tab)
    {
        int intTab_lenght = byte_Tab.length >>> 2;
        int[]int_Tab = new int[intTab_lenght];
 
        for (int i=0; i<intTab_lenght; i++) {
            int j = i << 2;
            int x = 0;
            x += (byte_Tab[j++] &#038; 0xff) << 0;
            x += (byte_Tab[j++] &#038; 0xff) << 8;
            x += (byte_Tab[j++] &#038; 0xff) << 16;
            x += (byte_Tab[j++] &#038; 0xff) << 24;
            int_Tab[i] = x;
        }
        return int_Tab;
    }
}