From cdbf2639c04ad80902c357402db5dde698717611 Mon Sep 17 00:00:00 2001 From: OscarRequena Date: Fri, 4 Apr 2025 18:49:08 +0200 Subject: [PATCH] CORRECCION DEL NUM --- .idea/vcs.xml | 4 +++- .idea/workspace.xml | 26 ++++++++++++++------------ src/main/java/HelloEnumsApp.java | 10 +++++++++- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/.idea/vcs.xml b/.idea/vcs.xml index d843f34..35eb1dd 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,4 +1,6 @@ - + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 4384c99..21be847 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,7 +4,11 @@ + + - + { + "associatedIndex": 7 +} - - - - - - diff --git a/src/main/java/HelloEnumsApp.java b/src/main/java/HelloEnumsApp.java index a098fec..82819da 100644 --- a/src/main/java/HelloEnumsApp.java +++ b/src/main/java/HelloEnumsApp.java @@ -1,6 +1,6 @@ public class HelloEnumsApp { public static void main(String[] args) { - Ordenacion ordenacion = obtenerOrdenCadena1("Albania", "Alba"); + Ordenacion ordenacion = obtenerOrdenCadena1("Albania", "AlbaniA"); System.out.println(ordenacion); } @@ -28,7 +28,15 @@ private static boolean isGreaterString1ThanString2(String cad1, String cad2) { int numMaxChars = Math.min(numCarsCad1, numCarsCad2); + //FUNCIONA !!! :) + if (numCarsCad1 > numCarsCad2) + return isGreater; + + if (numCarsCad1 < numCarsCad2) + return !isGreater; + while(posCurrentChar < numMaxChars && isGreater) { + char currentChar1 = carsCad1[posCurrentChar]; char currentChar2 = carsCad2[posCurrentChar]; isGreater = currentChar1 > currentChar2;