code: public static List<LocatedBlock> corruptBlocksInFile(
      DistributedFileSystem dfs, String path, long offset, long length)
    throws IOException {
      List<LocatedBlock> corrupt = new LinkedList<LocatedBlock>();
      LocatedBlocks locatedBlocks =
        getBlockLocations(dfs, path, offset, length);
      for (LocatedBlock b: locatedBlocks.getLocatedBlocks()) {
        if (b.isCorrupt() ||
           (b.getLocations().length == 0 && b.getBlockSize() > 0)) {
          corrupt.add(b);
        }
      }
      return corrupt;
    }
docs: Returns the corrupt blocks in a file.