code: public File transform(File inputFile,
                            File outFile,
                            GlobalTransform transform) {
          try {
              DataInputStream dis = new DataInputStream(
                  new BufferedInputStream(new FileInputStream(inputFile)));
              // Read in the header for the matrix.
              int rows = dis.readInt();
              int cols = dis.readInt();
  
              DataOutputStream dos = new DataOutputStream(
                  new BufferedOutputStream(new FileOutputStream(outFile)));
              // Writeout the header for the new matrix.
              dos.writeInt(rows);
              dos.writeInt(cols);
  
              // Traverse each row and column value, transforming each entry.
              for (int row = 0; row < rows; ++row) {
                  for (int col = 0; col < cols; ++col) {
                      double val = dis.readFloat();
                      dos.writeFloat((float) transform.transform(row, col, val));
                  }
              }
  
              dos.close();
              return outFile;
          } catch (IOException ioe) {
              throw new IOError(ioe);
          }
      }
docs: {@inheritDoc}