Here you can find the source of countMSCandidates_m2(ArrayList
Parameter | Description |
---|---|
asHexAL | a parameter |
public static void countMSCandidates_m2(ArrayList<Character> asHexAL)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class Main { static Logger logger = LoggerFactory.getLogger("UTIL5"); /**//from w ww . j a va 2 s. c o m * grabs three bytes at a time - only divides them thusly for testing * as candidates for magic square. * * nibble1 = a * nibble2,3 = b * nibble4,5,6 = c * * note that the nibbles aren't sorted, like in the previous method. * * @param asHexAL */ public static void countMSCandidates_m2(ArrayList<Character> asHexAL) { int countI = 0; int noHitCountI = 0; int nibbleNumI = 6; int toI = asHexAL.size() / 6; for (int i = 0; i < toI; i += 6) { String aS = asHexAL.get(i).toString(); String bS = asHexAL.get(i + 1).toString() + asHexAL.get(i + 2).toString(); String cS = asHexAL.get(i + 3).toString() + asHexAL.get(i + 4).toString() + asHexAL.get(i + 5).toString(); int aI = Integer.parseInt(aS, 16); int bI = Integer.parseInt(bS, 16); int cI = Integer.parseInt(cS, 16); //logger.info(aI + " " + bI + " " + cI); if ((aI < bI) && (bI < (cI - aI))) { countI++; } else { noHitCountI++; } } logger.info("candidate count is: " + countI + " / " + noHitCountI); } }