private static void write2DArray(int rows, int cols, String dsName,
			FileFormat hdfFile, Group pGroup) throws Exception {

		int fid = -1, sid = -1, did = -1, wid = -1;
		int rank = 2;
		long[] dimensions = { rows, cols };
		double[][] values = new double[rows][cols]; // { { 1.123456789, 2.2 }, {
													// 3.3, 4.4 } };

		// populate the array
		double value = 1.0;
		for (int row = 0; row < rows; row++) {
			for (int col = 0; col < cols; col++) {
				values[row][col] = value++;
			}
		}

		try {
			fid = hdfFile.getFID();

			// Create the data space for the int dataset.
			sid = H5.H5Screate_simple(rank, dimensions, null);

			// Create the int array dataset.
			if ((fid >= 0) && (sid >= 0))
				did = H5.H5Dcreate(fid, pGroup + "/" + dsName,
						HDF5Constants.H5T_IEEE_F64BE, sid,
						HDF5Constants.H5P_DEFAULT);
			else
				out.println("> writeIntArrayToDataset FAILED while creating the int array dataset. fid="
						+ fid + ", sid=" + sid);

			// Write array to the dataset using default transfer properties.
			wid = H5.H5Dwrite(did, HDF5Constants.H5T_NATIVE_DOUBLE,
					HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
					HDF5Constants.H5P_DEFAULT, values);
			if (wid < 0)
				out.println("> writeIntArrayToDataset write FAILED to 3x3 int array, wid="
						+ wid);

			// End access to the data set and release resources used by it.
			if (did >= 0)
				H5.H5Dclose(did);
			// Terminate access to the data space.
			if (sid >= 0)
				H5.H5Sclose(sid);
		} catch (Throwable t) {
			out.println("> Error writing array during ImageProcessing: " + t.getMessage());
			return;
		}
	}