これについてどうすればよいかまったくわかりませんが、Java の AI パスファインディング システムに配列を使用しており、値を並べ替える必要があります。私が生成している配列は次のとおりです。
int[][] paths = new int[Settings.GAME_COLS][Settings.GAME_ROWS]; // Just creating an Array that has room for every tile in the Game, so the Array can be used like this: paths[x][y]
int tempF = 0;
tempF = Math.abs(14 + (((aiX + 1) - playerX) + ((aiY - 1) - playerY)));
paths[aiX + 1][aiY - 1] = tempF;
tempF = Math.abs(14 + (((aiX + 1) - playerX) + ((aiY + 1) - playerY)));
paths[aiX + 1][aiY + 1] = tempF;
tempF = Math.abs(14 + (((aiX - 1) - playerX) + ((aiY + 1) - playerY)));
paths[aiX - 1][aiY + 1] = tempF;
tempF = Math.abs(14 + (((aiX - 1) - playerX) + ((aiY - 1) - playerY)));
paths[aiX - 1][aiY - 1] = tempF;
tempF = Math.abs(10 + (((aiX + 1) - playerX) + (aiY - playerY)));
paths[aiX + 1][aiY ] = tempF;
tempF = Math.abs(10 + (((aiX - 1) - playerX) + (aiY - playerY)));
paths[aiX - 1][aiY ] = tempF;
tempF = Math.abs(10 + ((aiX - playerX) + ((aiY + 1) - playerY)));
paths[aiX ][aiY + 1] = tempF;
tempF = Math.abs(10 + ((aiX - playerX) + ((aiY - 1) - playerY)));
paths[aiX ][aiY - 1] = tempF;
それはすべて完全に機能し、必要な情報を含む配列を見つけて生成しますが、配列に追加された「tempF」値に基づいて配列をソートする必要があります。これを行う簡単な方法はありますか?