public static int[][] readIntMatrix(String filename) {
		File dataFile = new File(filename);
		List<Integer[]> tmpMatrix = new ArrayList<Integer[]>();
		Scanner fileScanner = null;
		Scanner lineScanner = null;
		int maxRowLength = 0;

		try {
			fileScanner = new Scanner(dataFile);

			while (fileScanner.hasNextLine()) {
				lineScanner = new Scanner(fileScanner.nextLine());
				List<Integer> tmpRow = new ArrayList<Integer>();

				fillIntList(tmpRow, lineScanner);

				Integer[] row = tmpRow.toArray(new Integer[tmpRow.size()]);
				tmpMatrix.add(row);
				
				if (row.length > maxRowLength)
					maxRowLength = row.length;
				
				if (lineScanner != null)
					lineScanner.close();
			}

		} catch (IllegalStateException illStateEx) {
			System.err.println("Illegal State error: " + illStateEx.getMessage());
		} catch (FileNotFoundException fileNotFoundEx) {
			System.err.println("IO error: " + fileNotFoundEx.getMessage());
		} catch (IOException ioEx) {
			System.err.println("IO error: " + ioEx.getMessage());
		} finally {
			if (fileScanner != null)
				fileScanner.close();
			if (lineScanner != null)
				lineScanner.close();
		}

		return getIntMatrixFromRowList(tmpMatrix, maxRowLength);
	}