Can't read int value

import java.io.*;
class binary
     public static void main(String args[])
          BufferedReader br;
          int ch=0;
          br = new BufferedReader(new InputStreamReader(System.in));
          System.out.println("enter value");
          try    
               ch = (int)br.read();
          catch(IOException e)
               System.out.println("Exception Caught");
          System.out.println("the value entered is :" +  ch);
}the read method used above reads an character and returns it integer value and if we want to read an integer value how to do so, i tried it in the above code but it doesn't work
is there any specific function for reading int values or we need to use the ByteStream classes instead of the Character ones
plz reply

thanks it worked
i read my number using the readLine() method as a
String and then converted it back to an int value
ut is there no method by which i could read values as
int from the console n not have to do the conversion
part.plz heply guys

Similar Messages

  • HOW can I convert int value char TO String

    I am trying to study Java by books, but sometimes it is quite difficult to find answers even to simple questions...
    I am writing a program that analyzes a Chinese text in Unicode. What I get from the text is CHAR int value (in decimals), and now I need to find them in another text file (with RegEx). But I can't find a way how to convert an INT value of a char into a String.
    Could you help me?
    Thank you in advance.

    You are confusing matters a bit. A char is a char is a char, no matter
    how you represent it. Have a look at this:char a= 'A';
    char b= 65;Both a and b have the same value. The representation of that value
    can be 'A' or 65 or even (char)('B'-1), because the decimal representation
    of 'B' is 66. Note the funny construct (char)(...). This construct casts
    the value ... back to the char type. Java performs all non-fraction
    arithmetic using four byte integers. The cast transforms it back to
    a two byte char type.
    Strings are just concatenations of zero or more chars. the charAt(i)
    method returns you the i-th char in a string. Have a look:String s= "AB";
    char a= 'A';
    char b= (char)(a+1);
    if (a == s.charAt(0)) System.out.println("yep");
    if (b == s.charAt(1)) System.out.println("yep");This piece of code prints "yep" two times. If you want to compare two
    Strings instead, you have to do this:String s= "AB";
    char a= 'A';
    char b= 'B';
    String t= ""+a+b;
    if (s.equals(t)) System.out.println("yep");Note the 'equals' method instead of the '==' operator. Also note that
    string t was constructed using those two chars. The above was a
    shorthand of something like this:StringBuffer sb= new StringBuffer("");
    sb.append(a);
    sb.append(b);
    String t= sb.toString();This is all handled by the compiler, for now, you can simply use the '+'
    operator if you want to append a char to a string. Note that it is not
    very efficient, but it'll do for now.
    Does this get your started?
    kind regards,
    Jos

  • How can I read the value of an SCXI-1124 channel in LabVIEW?

    Is there any way to read back the value of an output channel of SCXI-1124 in LabVIEW (version 6.1 or 7.0)? I want to sweep the output gradually, and want to avoid a sudden change. But this is difficult if the current status of the channel is unknown. Especially, when the computer is reset or shut down, the SCXI-1124 maintains the output voltages (which is good for my application), but I have no idea what those values are.

    If I understand, you can look in the MAX. Then, in the pheriferal you can find the Ntional Instrument Card inserted into the PC. When you test this card you can read the input signales of the card( Volt in general)which is the out put of the SCXI.
    regards
    Anwar

  • 10.2.0.4: Japanese insertion is ok but can't read the value

    Dear Experts,
    => Server 10.2.0.4 (machine 1)
    NLS_CHARACTERSET=WE8MSWIN1252
    NLS_NCHAR_CHARACTERSET=AL16UTF16
    Table is: t_Japanese (ID integer, VALUE NVARCHAR2(50));
    => Client 10.2.0.1 (machine 2)
    In the registry: NLS_LANG=JAPANESE_JAPAN.JA16SJIS
    => What I do:
    1. Server: I perform the insertion of っ character (taken from an Unicode table for Hiragana) : insert into t_Japanese (ID, VALUE) Values (1, UNISTR('\3063'));
    2. Client:
    Sqlplus.exe:
    select dump(value,1016), value from t_Japanese;
    Typ=1 Len=2 CharacterSet=AL16UTF16: 30,63
    é-
    Sqlplus*W*.exe
    Typ=1 Len=2 CharacterSet=AL16UTF16: 30,63
    <black_square>Á
    In both cases I'm not able to display the original っ character.
    Is it possible to get this character displayed using these tools?
    Thanks for any help.
    Regards,
    Guillaume
    Edited by: jboz on Apr 21, 2010 8:10 AM

    I do not remember if SQL*Plus can recognize NVARCHAR2 columns correctly and fetch them without converting first to the DB character set. Anyway, you can try to get the data out in SQL*Plus only if you change the default locale (for non-Unicode programs) of your Windows operating system to Japanese (in Control Panel, Regional Settings). Then, you need to set NLS_LANG=.JA16SJIS
    I would recommend the use of SQL Developer. It can display this data without touching the O/S.
    -- Sergiusz

  • How to read enumerated values from an OPC server via Datasocket

    Hi Labviewers,
    I am using LV8.2 and I am trying to find if it is possible to read enumerations from an OPC server via Datasocket, not just the values.
    I can successfully read a value for an OPC server via Datasocket and I get a value for example 3, is it possible to get the enumeration/string that corresponds to this value i.e. "Open".
    Many thanks in advance
    Dimitris

    Hi Sarah,
    With the input type as variant I get the following response:
    1                                     <-This is the current numeric value of the parameter
    4 Attribute(s):
       'Quality' -> 192
       'TimeHigh' -> 29861723
       'TimeLow' -> -665408304
       'Timestamp' -> 39.238E+3
    With the Input set to         Enum constant I get no values or strings coming back. With the Input set to                Ring constant I just get the numeric value   
    Dimitris   

  • To read the values in the spreadsheet

    Hi,
    I have an excel sheet with some values quoted and ended with a comma at the end ( so as to place in the where condition of the sql query)
    I need to use these values in the where condition of the sql query to get the result. I will use this query in the shell script.
    How can i read each value from the spreadsheet.
    Values in the spreadsheet:
    'TT.1',
    'TT.2',
    'TT.3',
    'TT.4',
    'TT.5'
    Please guide me.
    Many thanks in advance.

    Whats the file format? Is it XLS. If thats the case then you cant use External Table. You may need to go for Hetrogeneous Services. You can follow this link to know more about it
    http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:4406709207206#18830681837358
    On the other hand if your file format is CSV then you can go for external tables. Once you have your external table in place its just a matter of how you query it. But mind that the file need to be in the DB server and not on your client machine.

  • Read userPassword value using ldap code

    can i read the value of userPassword attribute value
    Author: srinivas.pappu Jun 21, 2005 8:43 AM
    Hi,
    am using sun one directory server 5.1. Is it possible to read the value of the userPassword attribute through the Ldap code.
    Thanks in advance
    Regds
    srini

    If i store the password in clear text, is it poossible to retrieve the password value ?
    Regds
    srini

  • Can u tell me how to convert int value in to string

    hi to all, can u tell me how to convert int value in to string.

    hi to all, can u tell me how to convert int value in
    to string.Even this way:
    int number = 155;
    String mystring = ""+155;
    [\code]                                                                                                                                                                                                                                                                                               

  • How can i store a value in a register, to be called up later in the program. I must be able to read and write to it.

    Im looking at a bearing reading and i only want it to do a case loop if the data has changed on the bearing, so i need a value of what it was a cycle ago to compare it with, how do i do this?

    Hi,
    I'm not sure I,ve understood you clearly but it looks like you need to use "shift registers" in the loop.
    Shift registers allow you to pass data from one iteration of the loop to another. For example in the situation when you need to know the value of some variable on previous iteration or on pre-previous etc.
    To create shift registers on the loop you have to right click on the border of the loop and select "Add shift register" from pop up menu. Two arrows will appear on the left and right sides of the loop. To write data to the shift register you have to wire them to the right arrow, and to read data you have to read it from the left arrow. When you read data from shift register you read the value from the previous iteration. When you write data - you wri
    te the curent value there. If you want to read preprevious data you have to click on the left side of shift register and select "Add Element". The new element (arrow) will appear which corresponds to preprevious value. And so on. To initialize shift registers before execution of the loop you have to wire the some data from the outside.
    Another solution of your problem is using of local variables. You can create them from pop up menu of each control or indicator on the diagram. You can set them as read or write local.
    Good luck.
    Read help.
    Oleg Chutko.
    Attachments:
    shift.vi ‏16 KB

  • How can we read the screen field values from the report selection screen wi

    Hi expart,
    How can we read the screen field values from the report selection screen with out having an ENTER button pressed  .
    Regards
    Razz

    use this code...
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_posnr.
    **Read the Values of the SCREEN FIELDs
    CALL FUNCTION 'DYNP_VALUES_READ'

  • How do I know if I can convert a String value to an int value or not?

    Hi,
    I want to know how to make the judgment that if I can convert a String value to an int value or not? Assume that I don't know the String is number or letters
    Thank you

    Encephalopathic wrote
    Again, why?One of the problems (have been dued) in my codelab asks us to write a class as follow
    Write a class definition of a class named 'Value' with the following:
    a constructor accepting a single integer paramter
    a constructor with no parameters
    a method 'setVal' that accepts a single parameter,
    a boolean method, 'wasModified' that returns true if setVal was ever called for the object.
    a method 'getVal' that returns an integer value as follows: if setVal has ever been called, it getVal returns the last value passed to setVal. Otherwise if the "single int parameter" constructor was used to create the object, getVal returns the value passed to that constructor. Otherwise getVal returns 0.
    The setVal(int y) returns nothing, so how do I know whether it has been called or not?
    Thank you

  • How can i change control values based on a read-in file?

    I understand that controls only have outputs and indicators only have inputs, but I'm looking for some help creating code that has the capabilities of both. Specifically and ideally, my front panel would allow the user to select an old spreadsheet file to read, and those values from the spreadsheet would be displayed. The user could then tweak those values to their liking, and then submit those tweaked values as a new file/overwrite the old/etc. The important part is the the indicating and controlling of the read in values.
    thanks
    Solved!
    Go to Solution.

    Using a local variable works well if I want to view and change a single value, but I want to view and change a few different values that are to be read in from a speadsheet. I have tried creating an array and then inserting numeric controls into the array, on the front panel. The code will run, but there is no output to the array control. I can't for the life of me pinpoint where the issue is.
    Is inserting multiple numeric controls into the array, not a good idea? Should I just create 3 separate numeric controls and local variables to get around this?
    Message Edited by csmrunman on 09-16-2009 11:48 AM
    Attachments:
    controlasindicator.vi ‏7 KB

  • How can i read every"number" value and not only the 1st?

    in the vi only the first "number" value(from the data acquisition)is read in the small loop.how can i make every value to be read?every value must be compared with the "numeric" constant,and,if greater the led must turn on.afterwards,when a value which is less than the "numeric" is found the led must turn off.please answer or send mail to [email protected]
    Attachments:
    oximet5.vi ‏152 KB

    The more I look at your program, the less I understand it.
    Why are you setting number = number in a case if SO2 = ""? number always equals number.
    In your sequence frames 1 and 4, you have no control over which write (date or time) happens first. Just placing one function to the left of another doesn't make it happen first if your wiring doesn't create data dependency. Review the section on Data Dependency in chapter 5 of the LabView User's Manual.
    It looks you're writing to and reading from the same file using Write File and Read Lines from File.vi. Why read back data you just wrote? You have the data on your diagram. If you want to convert it from string to numeric, use a Sring/Number Conversion function from the String palette.
    On Read Lines from File.vi (which I'm not sure you even need), you should use a shift register for the start of read offset rather than a local variable for mark after read (chars.). With a shift register, you can initialize it to 0 when the VI starts. Using a local, if you restart the VI, it will try to startup from where you left off the last time, but you just opened the file for create or replace.
    In your sequence frames 2 and 3, why do you wait for the number to be less than the numeric before writing a carriage return to the file? Also, LabView has a End of Line constant which adapts to the expected value for the operating system. That's generally more flexible than a Carriage Return.
    It looks to me like you're overusing control refnums. You don't need to use a control refnum and a property node to set or read a control's value if you can wire directly to the control's terminal.
    I really don't understand what you're doing with pause and variants. I may be missing the point, but it looks like you made this much more complicated than it needs to be. Why not keep it a boolean?
    For your pause-path, you open the file but never close it. You can lose data that way. You also open it using open function 3, create new file. You'll get an error if the file already exists.
    On a general note, your diagram would be easier to read if you were more selective in how you routed your wires: you have wires on top of wires, wires running under sub-VIs, wires running in the frame of a while loop, wires running under labels.
    I think there's a temptation to overuse sequences. I don't think you need one here. As I mentioned in my earlier message, case structures and shift registers will be more useful to you.

  • I can't read double codes  values through request.getParameterValues()

    Hello Everbody
    I have a simple problem.In the first jsp page have 4 comboBox all have name "photoSize" . option values of comboBox is (3R,4R,4"x6",8"x10"). i read these values in the next jsp pages
    String [] all=request.getParameterValues("photoSize");
    my problem is that when i selected 3R or 4R then values comes as 3R and 4R
    but when i selected the values 4"x6" or 8"x10" its only gave the output as 4 and 8.
    I cann't read these values as 4"x6" or 8"x10" . my requirement is that i have to read values as 4"x6" .or is there any other way to achieve these output.
    please any body help me it is urgent.
    Thanks in advance
    Riaz

    both single and double quotes can easily mess up JSP's so hard to say what exacly is wrong
    example:
    <select value="<c:out value="${avalue}"/>" >
    this will fail with  avalue contains a double quote because in HTMl the string becomes closed.There is no exact solution but i would suggest to not use those String as value for your select BUT use 0,1,2.... as value and then translate those in your code to the dimensions you need, thus avoiding the Quote problem

  • Can not read values for profile option proxy_user_id in routine& Routine

    Hi all ,
    I developed a new form in oracle apps R12 and deployed in respective top ,After entering all the details when i am going to save the data i am getting the message like
    Can not read values for profile option proxy_user_id in routine& Routine and no action is taking place .
    Can some one please help me how to avoid this issue.
    Thanks in advance,
    Srinivas

    Hi Srinivas,
    Please check below Metalink notes. Although it is not same as your issue but it will give you way to enable 'VISIBLE' flag(if not done already)
    _'Cannot Read Value For Profile Option Proxy_user_id' Error While Trying To Create an AR Invoice [ID 1280915.1_
    Thanks,
    JD                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for

  • How can I migrate from one user to another within the same computer?

    My main user account in my desktop is becoming buggy after to many migrations from different computers and long time usage. I would like to migrate from one user to another user within the same computer to see if this improves my current problems. Ho

  • Advice on external back up drive

    Hi, I've just purchased an external LaCie 500GB quadra HD to back up my internal drives (40GB and 120GB both partitioned in half with OS9 and OSX) and just wanted some advice as to how I should set up the external drive and what would be the best sof

  • Execution of Inbound Interfaces in EOIO for separate messages

    Hello XI Experts We have a proxy to jdbc scenario. The rquirement is like we have to delete all the data from the oracle table, insert the data records into the table,and call a stored procedure from xi which will be done sequentially. We will be sen

  • AME CS6 Application Not Activated

    Today I went to queue some videos in Adobe Media Encoder that I edited in Premiere Pro CS6 and received a message saying that the program that installed ME was not activated. "Thank you for installing Adobe Media Encoder CS6. The Adobe product that i

  • Will I be able to access recovered TM data?

    I know that this could become a long story, so I'll try to condense it as much as possible. We had some sort of problem starting our iMac and tried a bunch of things, finally just decided to reinstall the whole she-bang from original Leopard disks kn