Buggy code:
public class SolveFirstCorners extends Model { Color [ ] [ ] [ ] rubiksCubeFirstCorners = new Color [ 6 ] [ 3 ] [ 3 ] ; public SolveFirstCorners ( Color [ ] [ ] [ ] rubiksCubeFirstCross ) { } void InitializeGrid ( Color [ ] [ ] [ ] rubiksCubeFirstCross ) { } void doOneCorner ( Solution solution , Color c1 , Color c2 ) { String message = "" ; String coin = "blanc-" ; int [ ] cornerPos = findUnitaryCorner ( rubiksCubeFirstCorners , c1 , c2 ) ; if ( c2 . equals ( Color . green ) ) coin += "vert-" ; else if ( c2 . equals ( Color . orange ) ) coin += "orange-" ; else if ( c2 . equals ( Color . blue ) ) coin += "bleu-" ; else if ( c2 . equals ( Color . red ) ) coin += "rouge-" ; int cornerPosC2 = otherSideOfUnitaryCube [ cornerPos [ 0 ] ] [ cornerPos [ 1 ] ] [ cornerPos [ 2 ] ] ; Color c3 = getOtherSideOfUnitaryCube ( rubiksCubeFirstCorners , ( cornerPosC2 // 100 ) , ( ( cornerPosC2 // 10 ) % 10 ) , ( cornerPosC2 % 10 ) ) ; if ( c3 . equals ( Color . green ) ) coin += "vert" ; else if ( c3 . equals ( Color . orange ) ) coin += "orange" ; else if ( c3 . equals ( Color . blue ) ) coin += "bleu" ; else if ( c3 . equals ( Color . red ) ) coin += "rouge" ; if ( ( ( ( cornerPos [ 0 ] ) == 5 ) && ( ( cornerPos [ 1 ] ) == 0 ) ) && ( ( cornerPos [ 2 ] ) == 2 ) ) { message = ( ( "Le<seq2seq4repair_space>coin<seq2seq4repair_space>" + coin ) + "<seq2seq4repair_space>est<seq2seq4repair_space>bien<seq2seq4repair_space>positionné,<seq2seq4repair_space>tournons<seq2seq4repair_space>la<seq2seq4repair_space>face<seq2seq4repair_space>du<seq2seq4repair_space>bas<seq2seq4repair_space>vers<seq2seq4repair_space>la<seq2seq4repair_space>droite<seq2seq4repair_space>" ) + "pour<seq2seq4repair_space>placer<seq2seq4repair_space>le<seq2seq4repair_space>prochain<seq2seq4repair_space>coin" ; fillAnswerTab ( solution , rubiksCubeFirstCorners , 5 , 1 , message , "first<seq2seq4repair_space>corners" ) ; } else { if ( ( ( ( cornerPos [ 0 ] ) == 2 ) || ( ( cornerPos [ 0 ] ) == 5 ) ) || ( ( cornerPos [ 1 ] ) != 0 ) ) { if ( ( cornerPos [ 0 ] ) == 2 ) { message = ( ( ( ( "Le<seq2seq4repair_space>coin<seq2seq4repair_space>" + coin ) + "<seq2seq4repair_space>est<seq2seq4repair_space>sur<seq2seq4repair_space>la<seq2seq4repair_space>face<seq2seq4repair_space>d'en<seq2seq4repair_space>haut,<seq2seq4repair_space>on<seq2seq4repair_space>va<seq2seq4repair_space>commencer<seq2seq4repair_space>par<seq2seq4repair_space>le<seq2seq4repair_space>placer<seq2seq4repair_space>" ) + "sur<seq2seq4repair_space>une<seq2seq4repair_space>face<seq2seq4repair_space>latérale,<seq2seq4repair_space>couronne<seq2seq4repair_space>du<seq2seq4repair_space>haut.<seq2seq4repair_space>Pour<seq2seq4repair_space>cela,<seq2seq4repair_space>on<seq2seq4repair_space>le<seq2seq4repair_space>place<seq2seq4repair_space>au-dessus<seq2seq4repair_space>" ) + "de<seq2seq4repair_space>l'endroit<seq2seq4repair_space>où<seq2seq4repair_space>on<seq2seq4repair_space>le<seq2seq4repair_space>placera,<seq2seq4repair_space>on<seq2seq4repair_space>déplace<seq2seq4repair_space>le<seq2seq4repair_space>bord<seq2seq4repair_space>associé,<seq2seq4repair_space>on<seq2seq4repair_space>sort<seq2seq4repair_space>le<seq2seq4repair_space>coin<seq2seq4repair_space>de<seq2seq4repair_space>" ) + "la<seq2seq4repair_space>face<seq2seq4repair_space>tournée<seq2seq4repair_space>et<seq2seq4repair_space>on<seq2seq4repair_space>replace<seq2seq4repair_space>le<seq2seq4repair_space>bord." ; <START_BUG> while ( ( ( cornerPos [ 1 ] ) != 2 ) && ( ( cornerPos [ 2 ] ) != 2 ) ) { <END_BUG> fillAnswerTab ( solution , rubiksCubeFirstCorners , 2 , 1 , message , "first<seq2seq4repair_space>corners" ) ; cornerPos = findUnitaryCorner ( rubiksCubeFirstCorners , c1 , c2 ) ; } fillAnswerTab ( solution , rubiksCubeFirstCorners , 1 , 1 , message , "first<seq2seq4repair_space>corners" ) ; fillAnswerTab ( solution , rubiksCubeFirstCorners , 2 , 2 , message , "first<seq2seq4repair_space>corners" ) ; fillAnswerTab ( solution , rubiksCubeFirstCorners , 1 , 3 , message , "first<seq2seq4repair_space>corners" ) ; } else if ( ( cornerPos [ 0 ] ) == 5 ) { message = ( ( ( "Le<seq2seq4repair_space>coin<seq2seq4repair_space>" + coin ) + "<seq2seq4repair_space>est<seq2seq4repair_space>sur<seq2seq4repair_space>la<seq2seq4repair_space>face<seq2seq4repair_space>d'en<seq2seq4repair_space>bas,<seq2seq4repair_space>on<seq2seq4repair_space>va<seq2seq4repair_space>commencer<seq2seq4repair_space>par<seq2seq4repair_space>le<seq2seq4repair_space>placer<seq2seq4repair_space>" ) + "sur<seq2seq4repair_space>une<seq2seq4repair_space>face<seq2seq4repair_space>latérale,<seq2seq4repair_space>couronne<seq2seq4repair_space>du<seq2seq4repair_space>haut.<seq2seq4repair_space>Pour<seq2seq4repair_space>cela,<seq2seq4repair_space>on<seq2seq4repair_space>déplace<seq2seq4repair_space>le<seq2seq4repair_space>bord<seq2seq4repair_space>associé,<seq2seq4repair_space>" ) + "on<seq2seq4repair_space>sort<seq2seq4repair_space>le<seq2seq4repair_space>coin<seq2seq4repair_space>de<seq2seq4repair_space>la<seq2seq4repair_space>face<seq2seq4repair_space>tournée<seq2seq4repair_space>et<seq2seq4repair_space>on<seq2seq4repair_space>replace<seq2seq4repair_space>le<seq2seq4repair_space>bord." ; int faceOfOtherSideOfCorner = ( otherSideOfUnitaryCube [ cornerPos [ 0 ] ] [ cornerPos [ 1 ] ] [ cornerPos [ 2 ] ] ) // 100 ; fillAnswerTab ( solution , rubiksCubeFirstCorners , faceOfOtherSideOfCorner , 3 , message , "first<seq2seq4repair_space>corners" ) ; fillAnswerTab ( solution , rubiksCubeFirstCorners , 2 , 2 , message , "first<seq2seq4repair_space>corners" ) ; fillAnswerTab ( solution , rubiksCubeFirstCorners , faceOfOtherSideOfCorner , 1 , message , "first<seq2seq4repair_space>corners" ) ; } else { message = ( ( ( ( "Le<seq2seq4repair_space>coin<seq2seq4repair_space>" + coin ) + "<seq2seq4repair_space>est<seq2seq4repair_space>sur<seq2seq4repair_space>la<seq2seq4repair_space>face<seq2seq4repair_space>latérale<seq2seq4repair_space>mais<seq2seq4repair_space>sur<seq2seq4repair_space>la<seq2seq4repair_space>1e<seq2seq4repair_space>couronne,<seq2seq4repair_space>on<seq2seq4repair_space>va<seq2seq4repair_space>" ) + "commencer<seq2seq4repair_space>par<seq2seq4repair_space>le<seq2seq4repair_space>placer<seq2seq4repair_space>sur<seq2seq4repair_space>une<seq2seq4repair_space>face<seq2seq4repair_space>latérale,<seq2seq4repair_space>couronne<seq2seq4repair_space>du<seq2seq4repair_space>haut,<seq2seq4repair_space>sans<seq2seq4repair_space>casser<seq2seq4repair_space>la<seq2seq4repair_space>croix.<seq2seq4repair_space>" ) + "Pour<seq2seq4repair_space>cela,<seq2seq4repair_space>" ) + "on<seq2seq4repair_space>déplace<seq2seq4repair_space>le<seq2seq4repair_space>bord<seq2seq4repair_space>associé,<seq2seq4repair_space>on<seq2seq4repair_space>sort<seq2seq4repair_space>le<seq2seq4repair_space>coin<seq2seq4repair_space>de<seq2seq4repair_space>la<seq2seq4repair_space>face<seq2seq4repair_space>tournée<seq2seq4repair_space>et<seq2seq4repair_space>on<seq2seq4repair_space>replace<seq2seq4repair_space>le<seq2seq4repair_space>bord." ; fillAnswerTab ( solution , rubiksCubeFirstCorners , cornerPos [ 0 ] , 1 , message , "first<seq2seq4repair_space>corners" ) ; if ( ( cornerPos [ 2 ] ) == 2 ) fillAnswerTab ( solution , rubiksCubeFirstCorners , cornerPos [ 0 ] , 2 , message , "first<seq2seq4repair_space>corners" ) ; fillAnswerTab ( solution , rubiksCubeFirstCorners , 2 , 2 , message , "first<seq2seq4repair_space>corners" ) ; fillAnswerTab ( solution , rubiksCubeFirstCorners , cornerPos [ 0 ] , 1 , message , "first<seq2seq4repair_space>corners" ) ; if ( ( cornerPos [ 2 ] ) == 0 ) fillAnswerTab ( solution , rubiksCubeFirstCorners , cornerPos [ 0 ] , 2 , message , "first<seq2seq4repair_space>corners" ) ; } } cornerPos = findUnitaryCorner ( rubiksCubeFirstCorners , c1 , c2 ) ; message = ( ( ( "Le<seq2seq4repair_space>coin<seq2seq4repair_space>" + coin ) + "<seq2seq4repair_space>est<seq2seq4repair_space>prêt<seq2seq4repair_space>à<seq2seq4repair_space>être<seq2seq4repair_space>placé,<seq2seq4repair_space>on<seq2seq4repair_space>va<seq2seq4repair_space>le<seq2seq4repair_space>mettre<seq2seq4repair_space>au-dessus<seq2seq4repair_space>de<seq2seq4repair_space>l'endroit<seq2seq4repair_space>" ) + "où<seq2seq4repair_space>il<seq2seq4repair_space>faut<seq2seq4repair_space>l'insérer,<seq2seq4repair_space>puis<seq2seq4repair_space>sortir<seq2seq4repair_space>le<seq2seq4repair_space>bord<seq2seq4repair_space>associé,<seq2seq4repair_space>ramener<seq2seq4repair_space>le<seq2seq4repair_space>coin,<seq2seq4repair_space>et<seq2seq4repair_space>replacer<seq2seq4repair_space>le<seq2seq4repair_space>tout.<seq2seq4repair_space>" ) + "Ensuite<seq2seq4repair_space>on<seq2seq4repair_space>tourne<seq2seq4repair_space>la<seq2seq4repair_space>face<seq2seq4repair_space>du<seq2seq4repair_space>bas<seq2seq4repair_space>vers<seq2seq4repair_space>la<seq2seq4repair_space>droite<seq2seq4repair_space>pour<seq2seq4repair_space>placer<seq2seq4repair_space>le<seq2seq4repair_space>prochain<seq2seq4repair_space>coin." ; if ( ( cornerPos [ 2 ] ) == 0 ) { while ( ( cornerPos [ 0 ] ) != 1 ) { fillAnswerTab ( solution , rubiksCubeFirstCorners , 2 , 1 , message , "first<seq2seq4repair_space>corners" ) ; cornerPos = findUnitaryCorner ( rubiksCubeFirstCorners , c1 , c2 ) ; } fillAnswerTab ( solution , rubiksCubeFirstCorners , 1 , 1 , message , "first<seq2seq4repair_space>corners" ) ; fillAnswerTab ( solution , rubiksCubeFirstCorners , 2 , 1 , message , "first<seq2seq4repair_space>corners" ) ; fillAnswerTab ( solution , rubiksCubeFirstCorners , 1 , 3 , message , "first<seq2seq4repair_space>corners" ) ; } else if ( ( cornerPos [ 2 ] ) == 2 ) { while ( ( cornerPos [ 0 ] ) != 0 ) { fillAnswerTab ( solution , rubiksCubeFirstCorners , 2 , 1 , message , "first<seq2seq4repair_space>corners" ) ; cornerPos = findUnitaryCorner ( rubiksCubeFirstCorners , c1 , c2 ) ; } fillAnswerTab ( solution , rubiksCubeFirstCorners , 0 , 3 , message , "first<seq2seq4repair_space>corners" ) ; fillAnswerTab ( solution , rubiksCubeFirstCorners , 2 , 3 , message , "first<seq2seq4repair_space>corners" ) ; fillAnswerTab ( solution , rubiksCubeFirstCorners , 0 , 1 , message , "first<seq2seq4repair_space>corners" ) ; } fillAnswerTab ( solution , rubiksCubeFirstCorners , 5 , 1 , message , "first<seq2seq4repair_space>corners" ) ; } }

Fix:
while ( ( ( cornerPos [ 1 ] ) * ( cornerPos [ 2 ] ) ) != 4 ) {