Hola!! les agradeceria muchisimo si me ayudan tantito en un programa. Soy novato, apenas estoy aprendiendo. Tengo que hacer un programa que convierta de numeros a letras, puedo usar switch y arreglos. Este es el que he estado haciendo, pero me marca un error y no estoy segura de porque.
- /* 
-  * To change this template, choose Tools | Templates 
-  * and open the template in the editor. 
-  */ 
- package Numletras; 
- import java.util.Scanner; 
- /** 
-  * 
-  * @author jhsd 
-  */ 
- public class Numletras { 
-   
-     /** 
-      * @param args the command line arguments 
-      */ 
-     public static void-  main (String[]-  args ) {
 
-          int largo=0, NUM=0,U=0,D=0,C=0; 
-         u [0]="cero"; 
-         u [1]="uno"; 
-         u [2]="dos"; 
-         u [3]="tres"; 
-         u [4]="cuatro"; 
-         u [5]="cinco"; 
-         u [6]="seis"; 
-         u [7]="siete"; 
-         u [8]="ocho"; 
-         u [9]="nueve"; 
-         esp [0]="once"; 
-         esp [1]="doce"; 
-         esp [2]="trece"; 
-         esp [3]="catorce"; 
-         esp [4]="quince"; 
-         d [0]=""; 
-         d [1]="dieci"; 
-         d [2]="veinti"; 
-         d [3]="treinta"; 
-         d [4]="cuarenta"; 
-         d [5]="cincuenta"; 
-         d [6]="sesenta"; 
-         d [7]="setenta"; 
-         d [8]="ochenta"; 
-         d [9]="noventa"; 
-         c [0]="ciento"; 
-         c [1]="doscientos"; 
-         c [2]="trescientos"; 
-         c [3]="cuatrocientos"; 
-         c [4]="quinientos"; 
-         c [5]="seiscientos"; 
-         c [6]="setecientos"; 
-         c [7]="ochocientos"; 
-         c [8]="novecientos"; 
-          
-         System- . out- . println("Proporcionar numero");
 
-         num=leer.nextLine(); 
-         largo=num.length(); 
-          if(largo==1){ 
-                     System- . out- . printf("\n"- +u [- NUM ]);
 
-          } 
-          if(largo==2){ 
-              if(NUM==10){ 
-              } 
-              if(NUM==20){ 
-                  System- . out- . printf("veinte\n");
 
-              } 
-              if(NUM<=15){ 
-                  System- . out- . printf(" "- +esp [- NUM- 11]);
 
-              } 
-              if(NUM>15){ 
-                 U=num.charAt(0); 
-                 D=num.charAt(1); 
-              System- . out- . printf(" "- +d [- D ]- + "y"- +u [- U ]);
 
-              } 
-          } 
-          if (largo==3){ 
-              if(NUM==100){ 
-              } 
-             U=num.charAt(0); 
-             D=num.charAt(1); 
-             C=num.charAt(2); 
-              System- . out- . printf(" "- +c [- C- 1]- + " "- +d [- D ]- + "y"- +u [- U ]);
 
-          } 
-          if (largo==4){ 
-          } 
-         // TODO code application logic here 
-     } 
- } 
-   
Este es el error que me marca:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 52
   at numletras.Numletras.main(Numletras.java:79)
Java Result: 1
Como ya dije, les agradeceria en el alma que me ayudaran. Segun yo la logica esta bien, pero como dije, soy un novato y me siento que no se nada.