LinkedList<Long> weights = new LinkedList<Long>();
StringTokenizer st = new StringTokenizer(encodedList.get(i), ",");
while(st.hasMoreTokens()) {
String token = st.nextToken();
Block block = BlockData.getBlock(KeyFactory.stringToKey(token));
blocks.add(block);
weights.add(block.getWeight());
}
Collections.sort(weights);
for(int j = 0; j < blocks.size(); j++) {
Block block = blocks.get(j);
block = BlockData.updateBlockOrder(block.getKey(), weights.get(j), locations.get(i));
if(block == null)
throw new ServerException("Operation failed partially or fully. <a href=''>Refresh</a> the page to see the changes.");
}
}
}