Example usage for java.lang Integer toString

List of usage examples for java.lang Integer toString

Introduction

In this page you can find the example usage for java.lang Integer toString.

Prototype

public String toString() 

Source Link

Document

Returns a String object representing this Integer 's value.

Usage

From source file:me.whitmarbut.mfa.TOTP.java

private String getToken(byte[] hmac) {
    int offset = hmac[19] & 0xf;

    Integer token = (int) ((((hmac[offset] & 0x7f) << 24) | ((hmac[offset + 1] & 0xff) << 16)
            | ((hmac[offset + 2] & 0xff) << 8) | (hmac[offset + 3] & 0xff)) % (Math.pow(10, 6)));
    String token_str = token.toString();
    if (token_str.length() < 6) {
        int to_add = 6 - token_str.length();
        for (int i = 0; i < to_add; i++) {
            token_str = "0" + token_str;
        }/*from   ww  w . j  a  v  a  2  s  . c om*/
    }

    return token_str;
}

From source file:gov.llnl.lc.infiniband.opensm.plugin.graph.IB_LevelTransformer.java

public int getGraphDecoratorNumber(Object G) {
    // the decorator number for a graph is the DOMINANT decorator number
    if (G instanceof UndirectedSparseMultigraph) {
        UndirectedSparseMultigraph ug = (UndirectedSparseMultigraph) G;
        Collection picked = new HashSet(visViewer.getPickedVertexState().getPicked());
        for (Object pv : picked) {
            if (pv instanceof UndirectedSparseMultigraph) {
                if (pv.equals(ug))
                    return getPickedNumber();
            }//w  ww.j  a  va2 s.c o  m
        }

        BinList<Integer> Number = new BinList<Integer>();
        // get ALL the decorator numbers from the graph
        ArrayList<Integer> list = getGraphDecoratorNumberArray(G);

        // loop through the number list and bin them up
        for (Integer i : list) {
            Number.add(i, i.toString());
        }
        // use the biggest bin
        long max = 0;
        for (long s : Number.getBinSizes()) {
            max = max < s ? s : max;
        }
        // there may be more than one this size, just use the first one I find
        ArrayList<ArrayList<Integer>> binList = Number.getBinsWithSize((new Long(max)).intValue());
        ArrayList<Integer> bin = binList.get(0);
        return bin.get(0).intValue();
    }
    return 0;
}

From source file:fr.fastconnect.factory.tibco.bw.maven.hawk.AbstractMethodAction.java

public void setArguments(String... arguments) {
    List<ImmutablePair<String, String>> _arguments = new ArrayList<ImmutablePair<String, String>>();

    Integer i = 0;
    for (String argument : arguments) {
        i++;//from  w w  w  .j av a 2 s . co  m
        _arguments.add(new ImmutablePair<String, String>("arg" + i.toString(), argument));
    }

    this.setArguments(_arguments);
}

From source file:fr.mailjet.rest.impl.UserRESTServiceImpl.java

@Override
public String trackingUpdate(EnumReturnType parType, Boolean parOpen, Boolean parClick)
        throws UniformInterfaceException, IllegalArgumentException {
    if (parOpen == null || parClick == null)
        throw new IllegalArgumentException();

    MultivaluedMap<String, String> locParameters = this.createHTTPProperties(parType);
    Integer locClick = this.toInteger(parClick);
    locParameters.putSingle(_click, locClick.toString());
    Integer locOpen = this.toInteger(parOpen);
    locParameters.putSingle(_open, locOpen.toString());
    return this.createPOSTRequest("userTrackingupdate", locParameters);
}

From source file:org.simbasecurity.core.domain.validator.UserNameValidatorImpl.java

@Override
public void validateUserName(String userName) {

    if (isEmpty(userName)) {
        throw new SimbaException(USERNAME_EMPTY);
    }

    Integer minLength = configurationService.getValue(USERNAME_MIN_LENGTH);

    if (userName.length() < minLength) {
        throw new SimbaException(USERNAME_TOO_SHORT, minLength.toString());
    }/*from  w  w w  .  j  a  va 2  s .com*/

    Integer maxLength = configurationService.getValue(USERNAME_MAX_LENGTH);

    if (userName.length() > maxLength) {
        throw new SimbaException(USERNAME_TOO_LONG, maxLength.toString());
    }

    String userRegex = configurationService.getValue(USERNAME_REGEX);

    if (!userName.matches(userRegex)) {
        throw new SimbaException(USERNAME_INVALID);
    }
}

From source file:com.aurel.track.fieldType.runtime.matchers.converter.SelectMatcherConverter.java

/**
 * Convert the object value to xml string for save
 * @param value/*from   w  w w  . j av a2  s.  co m*/
 * @param matcherRelation
 * @return
 */
@Override
public String toXMLString(Object value, Integer matcherRelation) {
    if (value == null || matcherRelation == null) {
        return null;
    }
    switch (matcherRelation.intValue()) {
    case MatchRelations.EQUAL:
    case MatchRelations.NOT_EQUAL:
        Integer[] intArr = null;
        try {
            intArr = (Integer[]) value;
        } catch (Exception e) {
            LOGGER.warn(
                    "Converting the " + value + " to Integer[] for XML string failed with " + e.getMessage());
            LOGGER.debug(ExceptionUtils.getStackTrace(e));
        }
        if (intArr != null && intArr.length > 0) {
            Integer intValue = intArr[0];
            if (intValue != null) {
                return intValue.toString();
            }
        }
    }
    return "";
}

From source file:com.norconex.jefmon.instance.action.impl.LogViewerActionPanel.java

private DropDownChoice<Integer> createLineQtyDropDown() {
    final List<Integer> choices = Arrays.asList(10, 20, 50, 100);
    final DropDownChoice<Integer> lineQtyDDC = new DropDownChoice<Integer>("lineQty", new Model<Integer>(10),
            choices, new IChoiceRenderer<Integer>() {
                private static final long serialVersionUID = 6925230811025968952L;

                @Override//from w ww  .jav a  2s  .com
                public Object getDisplayValue(Integer object) {
                    return object.toString();
                }

                @Override
                public String getIdValue(Integer object, int index) {
                    return object.toString();
                }
            });
    // Add Ajax Behaviour...
    lineQtyDDC.add(new AjaxFormComponentUpdatingBehavior("onchange") {
        private static final long serialVersionUID = 3867662005721342005L;

        protected void onUpdate(AjaxRequestTarget target) {
            linesReader.setLineQty(Integer.parseInt(lineQtyDDC.getInput()));
            refreshLines(target);
        }
    });
    lineQtyDDC.add(new BootstrapSelect());
    return lineQtyDDC;
}

From source file:com.jskj.assets.server.servcie.Sale.Sale_detailService.java

@Override
public Sale_detail_tb findSale_detail(Integer id) {
    Sale_detail_tbExample sale_detailExample = new Sale_detail_tbExample();
    sale_detailExample.createCriteria().andSaleIdEqualTo(id.toString());
    List<Sale_detail_tb> sale_details = mapper.selectByExample(sale_detailExample);
    for (Sale_detail_tb u : sale_details) {
        log.debug("found sale_detail:" + u.getSaleId());
    }//from   www  . jav  a2s  . c  o  m
    return sale_details.get(0);
}