public static int countColumns(String file) {
		try {
			// Open a file and read one line
			BufferedReader reader = new BufferedReader(new FileReader(file));
			String line = reader.readLine();
			reader.close();

			// Nothing to read?
			if (line == null) return 0;

			// Count fields
			String fields[] = line.split("\\s+");
			return fields.length;
		} catch (Exception e) {
			return -1;
		}
	}