Java tutorial
//package com.java2s; //License from project: Apache License public class Main { public static String getStateAcronym(String state) { if (state.equalsIgnoreCase("New South Wales")) return "NSW"; if (state.equalsIgnoreCase("Queensland")) return "QLD"; if (state.equalsIgnoreCase("Australian Capital Territory")) return "ACT"; if (state.equalsIgnoreCase("Victoria")) return "VIC"; if (state.equalsIgnoreCase("Northern Territory")) return "NT"; if (state.equalsIgnoreCase("Western Australia")) return "WA"; if (state.equalsIgnoreCase("South Australia")) return "SA"; if (state.equalsIgnoreCase("Tasmania")) return "TAS"; return state; } }