Skip to content

Instantly share code, notes, and snippets.

import java.io.IOException;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.ArrayList;
@GrenderG
GrenderG / comprobar matriz mágica
Last active August 29, 2015 14:20
comprobar matriz magica
public static boolean check (int[][] m) {
int masterSum = 0;
int tempSumRow = 0;
int tempSumCol = 0;
int diagonal = 0;
for (int i = 0; i < m.length; i++){
for (int j = 0; j < m[0].length; j++){
@GrenderG
GrenderG / getCicrclePositionMethod
Created April 22, 2015 08:38
View con circulos superpuestos.
public int[] getCirclePositions(int radius, int viewWidth, int items){
int[] positions = new int[items];
int portionSize = viewWidth / (items + 1);
for (int i = 0; i < positions.length; i++){
positions[i] = (portionSize*(i+1)) - radius;
}
return positions;
}