This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int[] BorraDeArray(int[] a, int posicion) | |
{ | |
int[] copia = CopiaArrayPro(a); | |
int i; | |
for(i = posicion; i < a.length-1; i++) | |
{ | |
copia[i] = copia[i + 1]; | |
} | |
copia = Arrays.copyOf(copia, copia.length-1); | |
return copia; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int[] Elimina1ElementoArray(int[] a, int valor) | |
{ | |
int[] copia = CopiaArrayPro(a); | |
int[] c2 = new int[a.length]; | |
int i; | |
for(i = 0; i < copia.length; i++) | |
{ | |
if(copia[i] == valor) | |
{ | |
c2 = BorraDeArray(copia, i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//PRIMER INTENTO... | |
public static int[] InsertaArrayEnArray(int[] a, int[] b, int posicion) | |
{ | |
int[] copia; | |
copia = Arrays.copyOf(a, a.length + b.length); | |
int j,i; | |
for(j = 0; j < a.length; j++) | |
{ | |
for(i = 0; i < b.length; i++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String AcentosHTML(String cadena) | |
{ | |
//Conjunto de caracteres html en una cadena separada por comas | |
String cadenaMnemo = "<,>,&,",á,Á" + | |
",&aecute;,É,í,Í,ó,Ó," + | |
"ú,Ú,ñ,Ñ,ü,Ü"; | |
//Convertimos cadena anterior en un array | |
String[] arrayMnemo = cadenaMnemo.split(","); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//FUNCIÓN PARA COMPROBAR SI UN ARRAY DE 9 ELEMENTOS CONTIENE 9 ELEMENTOS SI REPETIR | |
public static boolean compruebaArray19(int[] a) | |
{ | |
boolean esValido = false; | |
List<Integer> li = new ArrayList<>(); | |
int i; | |
for(i = 0; i < a.length; i++) //Pasamos los elementos del array a una lista siempre y cuando la lista no los contengan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean compruebaQuedanBarcos(int[][] tablero) | |
{ | |
boolean hayBarco = false; | |
List<Integer> li = new ArrayList<>(); | |
int[] claseBarcos = {2, 3, 4, 5}; //Array que contiene los nº que identifican a los barcos | |
int i, j, k; | |
k = 0; | |
for (i = 0; i < tablero.length; i++) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean compruebaSubarray3x3(int[][] sudoku) //case 103 | |
{ | |
boolean esValida = true; | |
int[] array = new int[9]; | |
int r; //Indice que itera el array | |
int i, j; //Indices para iterar de 3 en 3 las filas y las columnas | |
int k, e; //Indices que recorrerán los subarray 3x3 | |
for(i = 0; i < sudoku.length; i = i+3) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String eliminaCaracteresEspeciales(String c) | |
{ | |
String copia = c; | |
copia = copia.replaceAll("[^\\w\\s]",""); | |
return copia; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean comprobarFicheroExiste(String fichero) | |
{ | |
boolean existe = false; | |
if(Files.exists(Path.of(fichero))) | |
{ | |
existe = true; | |
} | |
return existe; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.company; | |
import java.io.BufferedWriter; | |
import java.io.File; | |
import java.io.FileWriter; | |
import java.nio.file.Path; | |
import java.util.*; | |
public class ClasificaMP3 | |
{ |
OlderNewer