

class DesEtc
{

    static int [] unpack32(long v)
    {
       return unpackAux( v, 32 ) ;
    }
  
    static int [] unpack48( long v )
    {
       return unpackAux( v, 48 ) ;
    }

    static int [] unpackAux(long v, int nBits)
    {
       int [] w = new int[nBits] ;
       for ( int i=(nBits-1); i>=0; i-- )
       {
           w[i] = (int) ( v & 0x01 ) ;
           v >>= 1 ;
       }
       return w ;
    }

    static int pack32( int [] v )
    {
       return (int) packAux( v, 32 ) ;
    }

    static long packAux( int [] v, int nBits )
    {
       long w = 0 ;
       for ( int i=0; i<nBits; i++ )
       {
           w <<= 1 ;
           w |= v[i] ;
       }
       return w ;
    }

}


