Skip to content

Instantly share code, notes, and snippets.

@billowdood
Created September 18, 2012 14:28
Show Gist options
  • Save billowdood/3743430 to your computer and use it in GitHub Desktop.
Save billowdood/3743430 to your computer and use it in GitHub Desktop.
Creacion de Regla
public void generacionReglaBinario(){
int i,j = 7,valorTemporalRegla = numeroRegla;
//Temporal array
int[] arrayTemporal = new int[8];
//pasar el numero de regla a binario
for(i = 0; i < 8; i++){
arrayTemporal[i] = valorTemporalRegla % 2;
valorTemporalRegla = valorTemporalRegla / 2;
}
//Acomodar el numero binario
i = 0;
do{
reglaBinario[i] = arrayTemporal[j];
i++;
j--;
}while( j >= 0);
}
public void generacionHashMapRegla(){
//Crear el hashmap con la regla
int i,j = 7;
for(i = 0;i < 8;i++){
valoresRegla.put(i,reglaBinario[j]);
j--;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment