Java slf4j Logger countMSCandidates_m2(ArrayList asHexAL)

Here you can find the source of countMSCandidates_m2(ArrayList asHexAL)

Description

grabs three bytes at a time - only divides them thusly for testing as candidates for magic square.

License

Apache License

Parameter

Parameter Description
asHexAL a parameter

Declaration

public static void countMSCandidates_m2(ArrayList<Character> asHexAL) 

Method Source Code


//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);

    }
}

Related

  1. close(final AutoCloseable closeable, final Logger log)
  2. closeQuietly(AutoCloseable toClose, Logger log)
  3. configureXWikiLogs()
  4. configureXWikiLogs()
  5. countMSCandidates(byte[] byteARR)
  6. d d(String fmt, Object... args)
  7. debug(Logger logger, Exception e)
  8. debug(Logger logger, String format, Object... arguments)
  9. displayProperties(Logger log, Properties prop)