Language: Java

import java.awt.Point;
import java.util.Scanner;

public class Main {

	/** ????§??????? */
	static final String WHITE_SPACE = " ";

	/** ??????????????????_X */
	static int mapSizeX = 0;

	/** ??????????????????_Y */
	static int mapSizeY = 0;

	/** ??????????????° */
	static int maxNode = 0;

	/** ????????? */
	//	static String[] map = new String[1000 * 1000];

	/** ????????¢??????????????? */
	/** ????????? */
	//	static List<Point> pachimonList = new ArrayList<Point>();
	//	static Point[] pachimonList = new Point[1000 * 1000];

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (scanner.hasNextLine()) {
			readMap(scanner);
		}

	}

	/** ????????? */
	//	static String[] map = new String[1000 * 1000];

	/** ????????¢??????????????? */
	/** ????????? */
	//	static List<Point> pachimonList = new ArrayList<Point>();
	//	static Point[] pachimonList = new Point[1000 * 1000];

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (scanner.hasNextLine()) {
			readMap(scanner);
		}

	}

	/**
	 * ?????????????????????????????????
	 * @param scanner ????????£??????
	 */
	private static void readMap(Scanner scanner) {
		String[] mapSizeLine = scanner.nextLine().split(WHITE_SPACE);
		if (mapSizeLine.length < 2) {
			return;
		}

		// ??????????????±????????????
		//		pachimonList.removeAll(pachimonList);
		maxNode = 0;
		//		mapSizeX = Integer.parseInt(mapSizeLine[0]);
		//		mapSizeY = Integer.parseInt(mapSizeLine[1]);
		//		initializeMap(mapSizeX, mapSizeY);

		for (int i = 0; i < mapSizeY; i++) {
			String mapInfoLine = scanner.nextLine();
			mapInfoLine = mapInfoLine.replaceAll(".", "9");
			mapInfoLine = mapInfoLine.replaceAll("S", "0");
			mapInfoLine = mapInfoLine.replaceAll("G", "6");
			for (int j = 0; j < mapSizeX; j++) {
				//					int val = Integer.valueOf(mapInfoLine.charAt(j));
				//					if (val < 9) {
				//						// ???????????¢????????°????¨????
				////						pachimonList[maxNode] = createPos(Integer.valueOf(val), calcIndex(j, i));
				//						maxNode++;
				//					}
			}
		}

		//		Collections.sort(pachimonList, new Comparator<Point>() {
		//			@Override
		//			public int compare(Point o1, Point o2) {
		//				return o1.x - o2.x;
		//			}
		//		});
	}

	//	/**
	//	 * ??????????????¨??????????´???????????????§?????????
	//	 */
	//	private static void initializeMap(int sizeX, int sizeY) {
	//		for (int i = 0; i < sizeX * sizeY; i++) {
	//			map[i] = "";
	//		}
	//	}

	/**
	 * X????????????????????´?????????????????¢???????±???§????¨????<br>
	 * ????????????:0?????´??????:6???????????¢???????±???§:1???5<br>
	 * Y????????????????????????????????????????´?
	 * @param type ?????????????????´?????????????????¢???????±???§
	 * @param index ??????????????????????????????
	 * @return
	 */
	private static Point createPos(int type, int index) {
		return new Point(type, index);
	}

	/**
	 * X??§?¨???¨Y??§?¨???????????????£?????????????????????????????????????????´?????????
	 *
	 * @param x X??§?¨?
	 * @param y Y??§?¨?
	 * @return
	 */
	private static int calcIndex(int x, int y) {
		return x * mapSizeY + y;
	}
}

Compiler output:
Main.java:48: error: method main(String[]) is already defined in class Main
	public static void main(String[] args) {
	                   ^
1 error