Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. public static int existeEnArreglo(int[] arreglo, int busqueda) {
  2. for (int x = 0; x < arreglo.length; x++) {
  3. if (arreglo[x] == busqueda) {
  4. return x;
  5. }
  6. }
  7. return -1;
  8. }
  9.  
  10. public static int existeEnArreglo(String[] arreglo, String busqueda) {
  11. for (int x = 0; x < arreglo.length; x++) {
  12. if (arreglo[x].equals(busqueda)) {
  13. return x;
  14. }
  15. }
  16. return -1;
  17. }
  18.  
  19. public static int existeEnArreglo(float[] arreglo, float busqueda) {
  20. for (int x = 0; x < arreglo.length; x++) {
  21. if (arreglo[x] == busqueda) {
  22. return x;
  23. }
  24. }
  25. return -1;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement