public static int[] buildDispersedMap(int picWidthInMbs, int picHeightInMbs, int numSliceGroups) {

        int picSizeInMbs = picWidthInMbs * picHeightInMbs;
        int[] groups = new int[picSizeInMbs];

        for (int i = 0; i < picSizeInMbs; i++) {
            int group = ((i % picWidthInMbs) + (((i / picWidthInMbs) * numSliceGroups) / 2)) % numSliceGroups;
            groups[i] = group;
        }

        return groups;
    }
public static int[] buildDispersedMap(int picWidthInMbs, int picHeightInMbs, int numSliceGroups) {

        int picSizeInMbs = picWidthInMbs * picHeightInMbs;
        int[] groups = new int[picSizeInMbs];

        for (int i = 0; i < picSizeInMbs; i++) {
            int group = ((i % picWidthInMbs) + (((i / picWidthInMbs) * numSliceGroups) / 2)) % numSliceGroups;
            groups[i] = group;
        }

        return groups;
    }
public static int [ ] buildDispersedMap ( int picWidthInMbs , int picHeightInMbs , int numSliceGroups ) { int picSizeInMbs = picWidthInMbs * picHeightInMbs ; int [ ] groups = new int [ picSizeInMbs ] ; for ( int i = 0 ; i < picSizeInMbs ; i ++ ) { int group = ( ( i % picWidthInMbs ) + ( ( ( i / picWidthInMbs ) * numSliceGroups ) / 2 ) ) % numSliceGroups ; groups [ i ] = group ; } return groups ; }
A dispersed map. Every odd line starts from the (N / 2)th group

Example:

0, 1, 2, 3, 0, 1, 2, 3 2, 3, 0, 1, 2, 3, 0, 1 0, 1, 2, 3, 0, 1, 2, 3 2,
3, 0, 1, 2, 3, 0, 1 0, 1, 2, 3, 0, 1, 2, 3 2, 3, 0, 1, 2, 3, 0, 1 0, 1,
2, 3, 0, 1, 2, 3 2, 3, 0, 1, 2, 3, 0, 1 0, 1, 2, 3, 0, 1, 2, 3 2, 3, 0,
1, 2, 3, 0, 1
A dispersed map . Every odd line starts from the ( N / 2 ) th group