Hello ^^
I asked the user for location code and then I need to find if location code is in the array of LOCATIONS and display this result "Region: ! | Location: ! |City: ! " in a method call format .. where the ! marks are the actual values from this location .. example Region: 2 | Location: ADD |City: Addis Ababa

I did the method for asking the user for input , but I didn't post with the codes
I did two methods format and locationInfo here is what I did,,,,

String[] LOCATIONS = {"ADD", "ALG", "AMM", "ASM", "BAH", "BEY", "BGW", "BKK", "BOM",
"CAI", "CGK", "CMB", "CMN", "DAC", "DAM", "DEL", "DIJ", "DOH",
"DXB", "EVN", "HKG", "ISB", "IST", "KBL", "KRT", "KTM", "KUL",
"KWI", "MCT", "MGQ", "MNL", "NBO", "PEK", "RUH", "SAH", "SGN",
"SHA", "SIN", "THR", "TIP", "TUN"};
String[] CITIES = {"Addis Ababa, Ethiopia", "Algiers, Algeria", "Amman, Jordan",
"Asmara, Eritrea", "Manama, Bahrain", "Beirut, Lebanon",
"Baghdad, Iraq", "Bangkok, Thailand", "Mumbai, India",
"Cairo, Egypt", "Jakarta, Indonesia", "Colombo, Sri Lanka",
"Casablanca, Morocco", "Dhaka, Bangladesh", "Damascus, Syria",
"New Delhi, India", "Djibouti City, Djibouti", "Doha, Qatar",
"Dubai, United Arab Emirates", "Yerevan, Armenia",
"Hong Kong, China", "Islamabad, Pakistan", "Istanbul, Turkey",
"Kabul, Afghanistan", "Khartoum, Sudan", "Kathmandu, Nepal",
"Kuala Lumpur, Malaysia", "Kuwait City, Kuwait", "Muscat, Oman",
"Mogadishu, Somalia", "Manila, Philippines", "Nairobi, Kenya",
"Bejing, China", "Riyadh, Saudi Arabia", "Sanaa, Yemen",
"Ho Chi Minh City, Vietnam", "Shanghai, China",
"Singapore, Singapore", "Tehran, Iran", "Tripoli, Libya",
"Tunis, Tunisia"};

int[] REGIONS = {2, 2, 2, 2, 1, 2, 2, 4, 3, 2, 4, 3, 3, 3, 2, 3, 2, 0, 1, 3, 4,
3, 2, 3, 2, 3, 4, 2, 1, 2, 4, 3, 4, 1, 2, 4, 4, 4, 1, 3, 3};

public static void locationInfo() {
put("Enter a location code:");
String code =sc.next();
String info = formatLocation(code);

put("Please give me something to do ...\n");

public static String format( String code) {
int postion=findLocationIndex(code);
// here if the user entered "AAA" for the location code it will show this message 
if(postion == -1) {
String result = ""; 

return result; 


Can you explain what your problem is?
If there are errors, please copy the full text and pasted it here.