protected static Block[] newBlocks(String resourceId, String hashes) { List<Block> result = new ArrayList<>(); int indexInFile = 0; for (int i = 0; i < hashes.length(); i += 2) { Block block = newBlock(resourceId, new ByteArray("0" + hashes.charAt(i)), indexInFile); result.add(block); indexInFile++; } return result.toArray(new Block[result.size()]); }