当前位置: 首页>>代码示例>>Java>>正文


Java Integer.MAX_VALUE属性代码示例

本文整理汇总了Java中java.lang.Integer.MAX_VALUE属性的典型用法代码示例。如果您正苦于以下问题:Java Integer.MAX_VALUE属性的具体用法?Java Integer.MAX_VALUE怎么用?Java Integer.MAX_VALUE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.lang.Integer的用法示例。


在下文中一共展示了Integer.MAX_VALUE属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: wrapperPBEKeyTest

private void wrapperPBEKeyTest(Provider p) throws InvalidKeySpecException,
        InvalidKeyException, NoSuchPaddingException,
        IllegalBlockSizeException, InvalidAlgorithmParameterException,
        NoSuchAlgorithmException {
    for (String alg : PBE_ALGORITHM_AR) {
        String baseAlgo = alg.split("/")[0].toUpperCase();
        // only run the tests on longer key lengths if unlimited version
        // of JCE jurisdiction policy files are installed

        if (Cipher.getMaxAllowedKeyLength(alg) < Integer.MAX_VALUE
                && (baseAlgo.endsWith("TRIPLEDES") || alg
                        .endsWith("AES_256"))) {
            out.println("keyStrength > 128 within " + alg
                    + " will not run under global policy");
            continue;
        }
        SecretKeyFactory skf = SecretKeyFactory.getInstance(baseAlgo, p);
        SecretKey key = skf.generateSecret(new PBEKeySpec("Secret Lover"
                .toCharArray()));
        wrapTest(alg, alg, key, key, Cipher.SECRET_KEY, true);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:22,代码来源:TestCipherKeyWrapperTest.java

示例2: getCaryString

public String getCaryString(){
    int humanNum = 0;
    int timeLimitNum=99999;
    int timeBonusNum=99999;
    if(redBot){
        humanNum+=(2*redDepth+4);//(redDepth/2+1)*4
    }
    if(blueBot){
        humanNum+=(blueDepth/2+1);
    }
    if(timeLimit[1]!=Integer.MAX_VALUE){
        timeLimitNum = timeLimit[1];
        timeBonusNum = timeBonus;
    }
    if(screen==2){
        boardStart = getBoard();
        moveSequence = "";
    }
    String result = rules+","+Math.max(WIDTH,HEIGHT)+","+timeLimitNum+","+timeBonusNum+","+humanNum+","+boardStart+moveSequence;
    return result;
}
 
开发者ID:hanss314,项目名称:GOLAD,代码行数:21,代码来源:MyWorld.java

示例3: setTimeLimit

public void setTimeLimit(int hours,int minutes,int seconds, int milliseconds){
    timeLimit = new int[]{hours,minutes,seconds,milliseconds};
    if(screen==3){
        removeObjects(getObjectsAt(750,180,Text.class));
        if(hours==Integer.MAX_VALUE){
            addObject(new Text("Untimed",30),750,180);
        }else{
            String maxTimeString = String.valueOf(hours)+":"+
                String.valueOf(minutes)+":"+
                String.valueOf(seconds);
            addObject(new Text(maxTimeString,30),750,180);
        }
    }
}
 
开发者ID:hanss314,项目名称:GOLAD,代码行数:14,代码来源:MyWorld.java

示例4: readBoard

public void readBoard(String in,boolean update){   
    moveSequence = "";
    redTurn = true;
    blueTurn = false;
    try{
        String[] parts;
        boolean newMode = false;
        char[] id = in.toCharArray();
        if(id[0]=='B'){
            int indexOfFirstComma = in.indexOf(",");
            int indexOfFirstSlash = in.indexOf("/");
            birth.clear();
            survive.clear();
            for(int i=1;i<indexOfFirstSlash;i++){
                birth.add(Character.getNumericValue(id[i]));
            }
            for(int i=indexOfFirstSlash+2;i<indexOfFirstComma;i++){
                survive.add(Character.getNumericValue(id[i]));
            }
            parts = in.substring(indexOfFirstComma+1).split(",");
        }else{
            parts = in.split(",");
        }
        if (parts.length < 5) {
            throw new IOException();
        }
 
        WIDTH = HEIGHT = Math.min(Math.max(Integer.parseInt(parts[0]),3),20);
        timeLimit[0]=0;
        timeLimit[1] = Integer.parseInt(parts[1]);
        timeLimit[2]=0;
        timeLimit[3]=0;
        timeBonus = Integer.parseInt(parts[2]);
        int humanNum = Integer.parseInt(parts[3]);
        stringToBoard(parts[4],update);
        /*redDepth = (int)(((humanNum/4)-1)*2);
        blueDepth = (((humanNum%4)-1)*2);
        if(redDepth<0){
            redBot = false;
        }else{
            redBot = true;
        }
        if(blueDepth<0){
            blueBot = false;
        }else{
            redBot = true;
        }*/
        int noSwapsUntil = -1;
        String[] moves = new String[parts.length-5];
        for(int i = 0; i<moves.length; i++){
            moves[i]=parts[i+5];
        } 
        int moveLimit = Integer.MAX_VALUE;
        if(screen==4){
            moveArray = moves;        
            totalMoves = moveArray.length;
            moveNumber = 0;
            saveTiles();
        }else{
            saveTiles();
            for (int t = 0; t < moves.length; t++) { // Go through all the moves.
                makeMove(moves[t]);
            } 
        }
        updateNumbers();
        updateLists();            
        boardStart = getBoard();
    }catch (Exception e) {
        JFrame frame = new JFrame("Error");
        JOptionPane.showMessageDialog(frame, "Illegal game string", "Error", 0);
    }       
}
 
开发者ID:hanss314,项目名称:GOLAD,代码行数:72,代码来源:MyWorld.java

示例5: playerSelect

public void playerSelect(){
    killAll();
    selected = 0;
    screen = 3;
    HEIGHT = 20;
    WIDTH = 20;
    birth.clear();
    survive.clear();
    birth.add(3);
    survive.add(2);
    survive.add(3);
    redBot = false;
    blueBot = false;
    timeLimit = new int[]{Integer.MAX_VALUE,Integer.MAX_VALUE,Integer.MAX_VALUE,Integer.MAX_VALUE};
    timeBonus = 0;
    addObject(new Text("Player 1", Color.red, 70+fontScale), 200, 40);
    addObject(new SelectPlayers(this, 6),200,120);
    addObject(new Text("Player 2", Color.blue, 70+fontScale), 200, 200);
    addObject(new SelectPlayers(this, 6),200,280);
    addObject(new BoardSize(this),500,120);
    addObject(new Text("20x20",30),500,150);
    addObject(new ChangeRules(this),500,240);
    drawRules();
    addObject(new TimeLimit(this),750,120);
    addObject(new Text("Untimed",30),750,180);
    addObject(new TimeBonus(this),750,240);
    addObject(new Text("0s",30),750,300);
    addObject(new PlayGame(this),435,450);
    addObject(new MainMenu(this), 435,530);      
}
 
开发者ID:hanss314,项目名称:GOLAD,代码行数:30,代码来源:MyWorld.java

示例6: wrapperBlowfishKeyTest

private void wrapperBlowfishKeyTest() throws InvalidKeyException,
        NoSuchAlgorithmException, NoSuchPaddingException,
        IllegalBlockSizeException, InvalidAlgorithmParameterException {
    // how many kinds of padding mode
    int padKinds;
    // Keysize should be multiple of 8 bytes.
    int KeyCutter = 8;
    int kSize = BLOWFISH_MIN_KEYSIZE;
    String algorithm = "Blowfish";
    int maxAllowKeyLength = Cipher.getMaxAllowedKeyLength(algorithm);
    boolean unLimitPolicy = maxAllowKeyLength == Integer.MAX_VALUE;
    SecretKey key = null;
    while (kSize <= BLOWFISH_MAX_KEYSIZE) {
        for (String mode : MODEL_AR) {
            // PKCS5padding is meaningful only for ECB, CBC, PCBC
            if (mode.equalsIgnoreCase(MODEL_AR[0])
                    || mode.equalsIgnoreCase(MODEL_AR[1])
                    || mode.equalsIgnoreCase(MODEL_AR[2])) {
                padKinds = PADDING_AR.length;
            } else {
                padKinds = 1;
            }
            // Initialization
            KeyGenerator kg = KeyGenerator.getInstance(algorithm);
            for (int k = 0; k < padKinds; k++) {
                String transformation = algorithm + "/" + mode + "/"
                        + PADDING_AR[k];
                if (NOPADDING.equals(PADDING_AR[k]) && kSize % 64 != 0) {
                    out.println(transformation
                            + " will not run if input length not multiple"
                            + " of 8 bytes when padding is " + NOPADDING);
                    continue;
                }
                kg.init(kSize);
                key = kg.generateKey();
                // only run the tests on longer key lengths if unlimited
                // version of JCE jurisdiction policy files are installed
                if (!unLimitPolicy && kSize > LINIMITED_KEYSIZE) {
                    out.println("keyStrength > 128 within " + algorithm
                            + " will not run under global policy");
                } else {
                    wrapTest(transformation, transformation, key, key,
                            Cipher.SECRET_KEY, false);
                }
            }
        }
        if (kSize <= LINIMITED_KEYSIZE) {
            KeyCutter = 8;
        } else {
            KeyCutter = 48;
        }
        kSize += KeyCutter;
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:54,代码来源:TestCipherKeyWrapperTest.java

示例7: TableColumn

/**
 *  Creates and initializes an instance of
 *  <code>TableColumn</code> with the specified model index,
 *  width, cell renderer, and cell editor;
 *  all <code>TableColumn</code> constructors delegate to this one.
 *  The value of <code>width</code> is used
 *  for both the initial and preferred width;
 *  if <code>width</code> is negative,
 *  they're set to 0.
 *  The minimum width is set to 15 unless the initial width is less,
 *  in which case the minimum width is set to
 *  the initial width.
 *
 *  <p>
 *  When the <code>cellRenderer</code>
 *  or <code>cellEditor</code> parameter is <code>null</code>,
 *  a default value provided by the <code>JTable</code>
 *  <code>getDefaultRenderer</code>
 *  or <code>getDefaultEditor</code> method, respectively,
 *  is used to
 *  provide defaults based on the type of the data in this column.
 *  This column-centric rendering strategy can be circumvented by overriding
 *  the <code>getCellRenderer</code> methods in <code>JTable</code>.
 *
 * @param modelIndex the index of the column
 *  in the model that supplies the data for this column in the table;
 *  the model index remains the same
 *  even when columns are reordered in the view
 * @param width this column's preferred width and initial width
 * @param cellRenderer the object used to render values in this column
 * @param cellEditor the object used to edit values in this column
 * @see #getMinWidth()
 * @see JTable#getDefaultRenderer(Class)
 * @see JTable#getDefaultEditor(Class)
 * @see JTable#getCellRenderer(int, int)
 * @see JTable#getCellEditor(int, int)
 */
public TableColumn(int modelIndex, int width,
                             TableCellRenderer cellRenderer,
                             TableCellEditor cellEditor) {
    super();
    this.modelIndex = modelIndex;
    preferredWidth = this.width = Math.max(width, 0);

    this.cellRenderer = cellRenderer;
    this.cellEditor = cellEditor;

    // Set other instance variables to default values.
    minWidth = Math.min(15, this.width);
    maxWidth = Integer.MAX_VALUE;
    isResizable = true;
    resizedPostingDisableCount = 0;
    headerValue = null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:54,代码来源:TableColumn.java

示例8: main

public static void main(String[] args) throws Exception {

        TestCipherKeyWrapperTest test = new TestCipherKeyWrapperTest();
        // AESWrap and DESedeWrap test
        for (AlgorithmWrapper algoWrapper : AlgorithmWrapper.values()) {
            String algo = algoWrapper.getAlgorithm();
            String wrapper = algoWrapper.getWrapper();
            try {
                int keySize = algoWrapper.getKeySize();
                // only run the tests on longer key lengths if unlimited
                // version of JCE jurisdiction policy files are installed
                if (!(Cipher.getMaxAllowedKeyLength(algo) == Integer.MAX_VALUE)
                        && keySize > LINIMITED_KEYSIZE) {
                    out.println(algo + " will not run if unlimited version of"
                            + " JCE jurisdiction policy files are installed");
                    continue;
                }
                test.wrapperAesDESedeKeyTest(algo, wrapper, keySize);
                if (algoWrapper == AlgorithmWrapper.NegtiveWrap) {
                    throw new RuntimeException("Expected not throw when algo"
                            + " and wrapAlgo are not match:" + algo);
                }
            } catch (InvalidKeyException e) {
                if (algoWrapper == AlgorithmWrapper.NegtiveWrap) {
                    out.println("Expepted exception when algo"
                            + " and wrapAlgo are not match:" + algo);
                } else {
                    throw e;
                }
            }
        }
        test.wrapperBlowfishKeyTest();
        // PBE and public wrapper test.
        String[] publicPrivateAlgos = new String[] { "DiffieHellman", "DSA",
                "RSA" };
        Provider provider = Security.getProvider(SUN_JCE);
        if (provider == null) {
            throw new RuntimeException("SUN_JCE provider not exist");
        }

        test.wrapperPBEKeyTest(provider);
        // Public and private key wrap test
        test.wrapperPublicPriviteKeyTest(provider, publicPrivateAlgos);
    }
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:44,代码来源:TestCipherKeyWrapperTest.java


注:本文中的java.lang.Integer.MAX_VALUE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。