Java Arrays.fill Examples

Java Arrays.fill - 30 examples found. These are the top rated real world Java examples of java.util.Arrays.fill extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
 // Check if OK should be enabled
 // Called on:
 //      -- change in text field
 //      -- change in check box selection
 //      -- change in team combo selection
 // Required:
 //      -- userName
 //      -- at least one check box
 //      -- password, if this is an Add, but not if Edit
 // Not required: TBD: ???
 //      -- First and Last Name
 //      -- Team
 private void checkOkSetEnabled() {
   char[] pchars = password.getPassword();
   char[] cchars = confirmPassword.getPassword();
   if (!userName.getText().equals("")
       && (unitizeCheckBox.isSelected()
           || uqcCheckBox.isSelected()
           || codingCheckBox.isSelected()
           || codingqcCheckBox.isSelected()
           || listingCheckBox.isSelected()
           || tallyCheckBox.isSelected()
           || qaCheckBox.isSelected()
           || tlCheckBox.isSelected()
           || adminCheckBox.isSelected())
       && (usersId != 0 || pchars.length != 0)
       && (pchars.length == 0 || cchars.length != 0)) {
     okButton.setEnabled(true);
   } else {
     okButton.setEnabled(false);
   }
   if (pchars.length == 0) {
     confirmPassword.setEditable(false);
   } else {
     confirmPassword.setEditable(true);
   }
   Arrays.fill(pchars, '#');
   Arrays.fill(cchars, '#');
 }
Example #2
0
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st;
    int cases = 1;
    while (true) {
      st = new StringTokenizer(in.readLine());
      n = Integer.parseInt(st.nextToken());
      m = Integer.parseInt(st.nextToken());
      if (n == 0 && m == 0) break;
      a = new int[n];
      b = new int[m];
      dp = new int[n + 1][m + 1];
      st = new StringTokenizer(in.readLine());
      for (int i = 0; i < n; i++) {
        a[i] = Integer.parseInt(st.nextToken());
        Arrays.fill(dp[i], -1);
      }
      Arrays.fill(dp[n], -1);
      st = new StringTokenizer(in.readLine());
      for (int i = 0; i < m; i++) b[i] = Integer.parseInt(st.nextToken());

      System.out.println("Twin Towers #" + cases);
      System.out.println("Number of Tiles : " + LCS(0, 0));
      System.out.println();
      cases++;
    }
    in.close();
    System.exit(0);
  }
  public Chunk(World par1World, int par2, int par3) {
    this.storageArrays = new ExtendedBlockStorage[16];
    this.blockBiomeArray = new byte[256];
    this.precipitationHeightMap = new int[256];
    this.updateSkylightColumns = new boolean[256];
    this.isGapLightingUpdated = false;
    this.chunkTileEntityMap = new HashMap();
    this.isTerrainPopulated = false;
    this.isModified = false;
    this.hasEntities = false;
    this.lastSaveTime = 0L;
    this.sendUpdates = false;
    this.field_82912_p = 0;
    this.queuedLightChecks = 4096;
    this.field_76653_p = false;
    this.entityLists = new List[16];
    this.worldObj = par1World;
    this.xPosition = par2;
    this.zPosition = par3;
    this.heightMap = new int[256];

    for (int var4 = 0; var4 < this.entityLists.length; ++var4) {
      this.entityLists[var4] = new ArrayList();
    }

    Arrays.fill(this.precipitationHeightMap, -999);
    Arrays.fill(this.blockBiomeArray, (byte) -1);
  }
  private void init() {

    this.entries = new HashMap<>(numTicks);
    clear();

    //        Log.v(TAG, "after clear");

    // two for loops to reorder (since angle 0 - 90)
    this.tickAngle = new float[numTicks];
    this.tickSpace = new float[numTicks];
    Arrays.fill(tickAngle, 0.f);
    Arrays.fill(tickSpace, 0.f);
    float bumpBottom = 0;
    int intermedTicks = numTicks / 12;
    for (int ticks = 0; ticks < numTicks; ticks++) {

      //            Log.v(TAG, "at tick " + ticks);

      if (ticks < numTicks / 4) {
        tickAngle[ticks] = (ticks * tickLength + space) + 270.f;
      } else {
        tickAngle[ticks] = (ticks * tickLength + space) - 90.f;
      }

      if (ticks == numTicks / 2 - intermedTicks && numTicks <= numTicks / 2) {
        bumpBottom += 3;
      }
      tickSpace[ticks] = spaceTillBorder + bumpBottom;
    }
  }
Example #5
0
  @Test
  public void WAL_replay_mixed() {
    e = openEngine();
    e.structuralLock.lock();

    for (int i = 0; i < 3; i++) {
      long v = e.composeIndexVal(100 + i, e.round16Up(10000) + i * 16, true, true, true);
      e.walPutLong(0xF0000 + i * 8, v);
      byte[] d = new byte[9];
      Arrays.fill(d, (byte) i);
      e.putDataSingleWithoutLink(-1, e.round16Up(100000) + 64 + i * 16, d, 0, d.length);
    }
    e.commit();
    e.structuralLock.lock();
    e.commitLock.lock();
    e.replayWAL();

    for (int i = 0; i < 3; i++) {
      long v = e.composeIndexVal(100 + i, e.round16Up(10000) + i * 16, true, true, true);
      assertEquals(v, e.vol.getLong(0xF0000 + i * 8));

      byte[] d = new byte[9];
      Arrays.fill(d, (byte) i);
      byte[] d2 = new byte[9];

      e.vol.getData(e.round16Up(100000) + 64 + i * 16, d2, 0, d2.length);
      assertTrue(Serializer.BYTE_ARRAY.equals(d, d2));
    }
  }
Example #6
0
  public void digestData() throws IOException, PKCS11Exception {
    byte[] buffer = new byte[1024];
    byte[] helpBuffer, testDigest;
    int bytesRead;

    System.out.println("Digest Data");
    myPKCS11Module_.C_DigestInit(session_, digestMechanism_);
    try {
      messageDigest_ = MessageDigest.getInstance("SHA-1");
    } catch (Exception e) {
      System.out.println(e);
    }
    InputStream dataInput = new FileInputStream(file_);
    while ((bytesRead = dataInput.read(buffer, 0, buffer.length)) >= 0) {
      helpBuffer =
          new byte[bytesRead]; // we need a buffer that only holds what to send for digesting
      System.arraycopy(buffer, 0, helpBuffer, 0, bytesRead);
      myPKCS11Module_.C_DigestUpdate(session_, helpBuffer);
      messageDigest_.update(helpBuffer);
      Arrays.fill(helpBuffer, (byte) 0);
    }
    Arrays.fill(buffer, (byte) 0);
    digest_ = myPKCS11Module_.C_DigestFinal(session_);
    testDigest = messageDigest_.digest();
    System.out.println("PKCS11digest:" + Functions.toHexString(digest_));
    System.out.println("TestDigest  :" + Functions.toHexString(testDigest));
    System.out.println("FINISHED\n");
  }