private static int[] stringToIntArray(String str) throws Exception
        {
            int slength=str.length();
            int retval[] = new int[(int) Math.ceil(slength / 4.0)];

            for (int i=0; i<retval.length; i++) {
                // note little-endian encoding - endianness is irrelevant as long as
                // it is the same in longsToStr()

                int char0=(i*4<slength)?str.charAt(i*4):0;
                int char1=(i*4+1<slength)?str.charAt(i*4+1):0;
                int char2=(i*4+2<slength)?str.charAt(i*4+2):0;
                int char3=(i*4+3<slength)?str.charAt(i*4+3):0;

                retval[i] = char0 + (char1<<8) +
                       (char2<<16) + (char3<<24);
            }
            return retval;
        }