Package java.util

Examples of java.util.Scanner.nextByte()


  {
    String testStr = "5F 7FFF 4F3F3F6F 3F3F2EF3FFEE 4FFAAEEFFAA";
    Scanner s = new Scanner (testStr);

    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)");
View Full Code Here


    s = new Scanner (testStr).useRadix (16);
    myHarness.check(s.radix(), 16, "radix was not set to 16");

    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()");
View Full Code Here

            /* Le client veut cr�diter la carte :
             * D'abord, on v�rifie s'il a d�j� renseign� son code pin (si ce n'est pas le cas, il devra le donner)
             * ensuite on cr�dite l'argent
             */
            System.out.print("Valeur : ");
            val = new byte[]{sc.nextByte()};
            send(PurseClientJC.INS_CREDIT,(byte)0x00,(byte)0x00,(byte)0x01,val,(byte)0x00);
           
            if (apdu.getStatus() == 0x6301) {
              // Code pin pas renseign� 
              System.out.print("Code Pin : ");
View Full Code Here

           
          case '3':
            apdu.command[Apdu.INS] = PurseClientJC.INS_DEBIT;
            System.out.print("Valeur : ");
            apdu.setLc(1);
            apdu.setDataIn(new byte[]{sc.nextByte()});
            cad.exchangeApdu(apdu);
            if (apdu.getStatus() != 0x9000) {
              System.out.println("Erreur : status word different de 0x9000 -> "+apdu.getStatus());
            } else {
              System.out.println("OK");
View Full Code Here

  public void setInputStream(final Reader reader) {
    Scanner scanner = new Scanner(reader);
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    while (scanner.hasNextByte()) {
      output.write(scanner.nextByte());
    }
    this.inputStream = new ByteArrayInputStream(output.toByteArray());
  }

  public void setInputStream(final File file) throws FileNotFoundException {
View Full Code Here

  public void setInputStream(final Reader reader) {
    Scanner scanner = new Scanner(reader);
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    while (scanner.hasNextByte()) {
      output.write(scanner.nextByte());
    }
    this.inputStream = new ByteArrayInputStream(output.toByteArray());
  }

  public void setInputStream(final File file) throws FileNotFoundException {
View Full Code Here

                System.out.println("\t 1. Area Trapezio.");
                System.out.println("\t 2. Area Rombo.");
                System.out.println("\t 3. Area Parallelogramma.");
                System.out.print("\n Digitare un numero [0 a 3]:  ");
               
                ch = inHandle.nextByte();
               
                switch(ch)
                {
                    case 0:
                        return;
View Full Code Here

      System.out.println( "Enter a Byte: " );
      while( !input.hasNextByte() ) {
        input.nextLine();
        System.out.println( "Not a Byte, try again" );
      }
      System.out.println( "You entered: " + input.nextByte() );
     
      System.out.println( "Enter a Float: " );
      while( !input.hasNextFloat() ) {
        input.nextLine();
        System.out.println( "Not a Float, try again" );
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.