How to shorten this code or make it more efficient? How to shorten up this code? I know there's a way that this kind of code could be shortened, but I don't know how by myself yet. Who can help me?

            //CHOOSE LEVEL: FROZEN
case 1213:
    sendOption5("Level 1 " + (c.achievedFloor &lt;= 1 ? "@gre@(Achieved)" : "@red@(Not achieved)") + "",
            "Level 2 " + (c.achievedFloor &lt;= 2 ? "@gre@(Achieved)" : "@red@(Not achieved)") + "",
            "Level 3 " + (c.achievedFloor &lt;= 3 ? "@gre@(Achieved)" : "@red@(Not achieved)") + "",
            "Level 4 " + (c.achievedFloor &lt;= 4 ? "@gre@(Achieved)" : "@red@(Not achieved)") + "",
            "More");
    c.dialogueAction = 1213;
    break;
case 1214:
    sendOption5("Level 5 " + (c.achievedFloor &lt;= 5 ? "@gre@(Achieved)" : "@red@(Not achieved)") + "",
            "Level 6 " + (c.achievedFloor &lt;= 6 ? "@gre@(Achieved)" : "@red@(Not achieved)") + "",
            "Level 7 " + (c.achievedFloor &lt;= 7 ? "@gre@(Achieved)" : "@red@(Not achieved)") + "",
            "Level 8 " + (c.achievedFloor &lt;= 8 ? "@gre@(Achieved)" : "@red@(Not achieved)") + "",
            "More");
    c.dialogueAction = 1214;
    break;
case 1215:
    sendOption5("Level 9 " + (c.achievedFloor &lt;= 9 ? "@gre@(Achieved)" : "@red@(Not achieved)") + "",
            "Level 10 " + (c.achievedFloor &lt;= 10 ? "@gre@(Achieved)" : "@red@(Not achieved)") + "",
            "Level 11 " + (c.achievedFloor &lt;= 11 ? "@gre@(Achieved)" : "@red@(Not achieved)") + "",
            "",
            "Choose Floor");
    c.dialogueAction = 1215;
    break;
In a first step I would extract a method to generate the string.

changed code:

            //CHOOSE LEVEL: FROZEN
case 1213:
    sendOption5(
            levelString( 1, c),
            levelString( 2, c),
            levelString( 3, c),
            levelString( 4, c),
            "More");
    c.dialogueAction = 1213; 
    break;
case 1214:
    sendOption5(
            levelString( 5, c),
            levelString( 6, c),
            levelString( 7, c),
            levelString( 8, c),
            "More");
    c.dialogueAction = 1214;
    break;
case 1215:
    sendOption5(
            levelString( 9, c),
            levelString(10, c),
            levelString(11, c),
            "",
            "Choose Floor");
    c.dialogueAction = 1215;
    break;


extracted method:

private static String levelString(int i, TypeOfC c){
   return "Level " + i + (c.achievedFloor &lt;= i ? " @gre@(Achieved)" : " @red@(Not achieved)");
}


You should also think about changing the parameters of your sendOption5 to get only c and two integers from to which define the inteval of values.

And you can move the c.dialogueAction = xxxx; line behind the switch and assign the value you use for the switch.