Advertisement
Guest User

Untitled

a guest
Feb 11th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.64 KB | None | 0 0
  1.  
  2. package ejercicio2;
  3.  
  4. import java.util.*;
  5.  
  6. public class Ejercicio2 {
  7.  
  8.     public static boolean hayNombreCorto(CharSequence[] a) {
  9.         boolean encontrado = false;
  10.         int i = 0;
  11.         while (!encontrado && i < a.length) {
  12.             if (a[i].length() < 6) {
  13.                 encontrado = true;
  14.             } else {
  15.                 i++;
  16.             }
  17.         }
  18.         return encontrado;
  19.     }
  20.  
  21.     public static void modificarSb(CharSequence[] a) {
  22.         for (CharSequence cs : a) {
  23.             if (cs instanceof StringBuilder) {
  24.                 ((StringBuilder)cs).append("/sb");
  25.             }
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement