Package java.util

Examples of java.util.Scanner.nextInt()


    int M = in.nextInt();
    Edge[] edges = new Edge[M];
    for (int m = 0; m < M; m++) {
      int a = in.nextInt() - 1;
      int b = in.nextInt() - 1;
      int c = in.nextInt();
      edges[m] = new Edge(a, b, c);
    }
    return edges;
  }
  int a, b;
View Full Code Here


             "4:Enquire Domain " +
             "5:Exit";
        
         System.out.println(commandStr);
         Scanner in = new Scanner(System.in);
         int choice = in.nextInt();
        
         switch(choice)
         {
            case 0: //Encrypt Keystore Password
               System.out.println("Enter Keystore password");
View Full Code Here

                  System.out.println("Enter Salt (String should be at least 8 characters)");
                  saltStr = in.next();
               }while(saltStr.length() < 8);
              
               System.out.println("Enter Iterator Count (integer value)");
               int iterationCount = in.nextInt();
              
               String ksPassFileName = PasswordMaskManagement.keystorePassEncFileName;
               String[] filePasswordArgs = new String[]
                                          {saltStr, iterationCount+""
                     , passStr, ksPassFileName};
View Full Code Here

  public static byte[] bitfield = new byte [(int) (numberOfInts / 8)];
 
  public static void findOpenNumber() throws FileNotFoundException {
    Scanner in = new Scanner(new FileReader("Chapter 10/Question10_3/input_file_q10_3.txt"));
    while (in.hasNextInt()) {
      int n = in.nextInt ();
      /* Finds the corresponding number in the bitfield by using
       * the OR operator to set the nth bit of a byte
       * (e.g., 10 would correspond to the 2nd bit of index 2 in
       * the byte array). */
      bitfield [n / 8] |= 1 << (n % 8);
View Full Code Here

      Scanner s = new Scanner (aktFile);
      i = 0;
      while (s.hasNextInt ())
  {
    tmp = s.nextInt ();
    this.myHarness.check (tmp, numbers[i],
        "nextInt() -> " + tmp + " != " + numbers[i]);
    i++;
  }
      this.myHarness.check (i, numbers.length,
View Full Code Here

    this.myHarness.check (tmpStr, delimiter,
        "get / setDelimiter fail (\"" + tmpStr +
        "\" != \"" + delimiter);
    this.myHarness.check (s1.hasNext (), true, "first hasNext()");
    this.myHarness.check (s1.hasNextInt (), true, "first hasNextInt()");
    this.myHarness.check (s1.nextInt (), 1, "nextInt()");
    this.myHarness.check (s1.hasNextInt (), true, "hasNextInt()");
    this.myHarness.check (s1.hasNextBoolean (), false, "hasNextBoolean()");
    this.myHarness.check (s1.hasNextByte (), true, "hasNextByte()");
    this.myHarness.check (s1.nextInt (), 2, "2. nextInt()");
    this.myHarness.check (s1.hasNext (), true, "3. hasNext()");
View Full Code Here

    this.myHarness.check (s1.hasNextInt (), true, "first hasNextInt()");
    this.myHarness.check (s1.nextInt (), 1, "nextInt()");
    this.myHarness.check (s1.hasNextInt (), true, "hasNextInt()");
    this.myHarness.check (s1.hasNextBoolean (), false, "hasNextBoolean()");
    this.myHarness.check (s1.hasNextByte (), true, "hasNextByte()");
    this.myHarness.check (s1.nextInt (), 2, "2. nextInt()");
    this.myHarness.check (s1.hasNext (), true, "3. hasNext()");
    this.myHarness.check (s1.hasNextBigInteger (), false,
        "hasNextBigInteger()");
    this.myHarness.check (s1.next (), "red", "3. next()");
    this.myHarness.check (s1.next (), "blue", "4. next()");
View Full Code Here

      Scanner s = new Scanner (this.aktFile);
      i = 0;
      while (s.hasNextInt ())
  {
    tmp = s.nextInt ();
    this.myHarness.check (tmp, numbers[i],
        "nextInt() -> " + tmp + " != " + numbers[i]);
    i++;
  }
      this.myHarness.check (i, numbers.length,
View Full Code Here

    myHarness.check(s.hasNextByte (16), "hasNextByte(16)");
    myHarness.check(s.nextByte(16), 95, "nextByte is 95");
    myHarness.check(s.hasNextShort(16), "hasNextShort(16)");
    myHarness.check(s.nextShort(16), 32767, "nextShort is 32767");
    myHarness.check(s.hasNextInt(16), "hasNextInt(16)");
    myHarness.check(s.nextInt(16), 1329545071, "nextInt is 1329545071");
    myHarness.check(s.hasNextLong(16), "hasNextLong(16)");
    myHarness.check(s.nextLong(16), 69540603232238L, "nextLong is 69540603232238");
    myHarness.check(s.hasNextBigInteger(16), "hasNextBigInteger(16)");
    myHarness.check(s.nextBigInteger(16), BigInteger.valueOf(5496130961322L),
        "nextBigInteger is 5496130961322");
View Full Code Here

    myHarness.check(s.hasNextByte (), "hasNextByte()");
    myHarness.check(s.nextByte(), 95, "nextByte is 95");
    myHarness.check(s.hasNextShort(), "hasNextShort()");
    myHarness.check(s.nextShort(), 32767, "nextShort is 32767");
    myHarness.check(s.hasNextInt(), "hasNextInt()");
    myHarness.check(s.nextInt(), 1329545071, "nextInt is 1329545071");
    myHarness.check(s.hasNextLong(), "hasNextLong()");
    myHarness.check(s.nextLong(), 69540603232238L, "nextLong is 69540603232238");
    myHarness.check(s.hasNextBigInteger(), "hasNextBigInteger()");
    myHarness.check(s.nextBigInteger(), BigInteger.valueOf(5496130961322L),
        "nextBigInteger is 5496130961322");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.