Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions src/main/java/HelloEnumsApp.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
public class HelloEnumsApp {
public static void main(String[] args) {
Ordenacion ordenacion = obtenerOrdenCadena1("Albania", "Alba");
Ordenacion ordenacion = obtenerOrdenCadena1("Alba", "Albania");
System.out.println(ordenacion);
}

Expand All @@ -26,14 +26,25 @@ private static boolean isGreaterString1ThanString2(String cad1, String cad2) {

int posCurrentChar = 0;

int numMaxChars = Math.min(numCarsCad1, numCarsCad2);
int numTotChars = Math.min(numCarsCad1, numCarsCad2);

while(posCurrentChar < numMaxChars && isGreater) {
boolean foundDif = false;

while(posCurrentChar < numTotChars && isGreater && !foundDif) {
char currentChar1 = carsCad1[posCurrentChar];
char currentChar2 = carsCad2[posCurrentChar];
isGreater = currentChar1 > currentChar2;

if (currentChar1 != currentChar2){
isGreater = currentChar1>currentChar2;
foundDif = true;
}
posCurrentChar++;

}
if (posCurrentChar == numTotChars && !foundDif){
isGreater = numCarsCad1 > numCarsCad2;
}


return isGreater;
}
Expand Down