Bitwise operations between int and char

I need to do an xor of the following type:
char c;
short i;
c = (char) (c ^ i);
but i keep getting an "incompatable type" error.
Any suggestions?

The following code:
public static void main(String[] args) {
    char c = '1';
    short i = 2;
    c = (char) (c ^ i);
    System.out.println(c);
}compiled and ran - I couldn't use your code as-is because I needed to initialize c and i, but other than that it worked out for me.
Sorry I couldn't help more
Lee

Similar Messages

  • Difference between int and byte

    what is the main difference between int and byte?

    A byte is the format data is stored in memory in past. 8 bits.
    An int is a format likewise you get it as value from the accumulator. For X64 that is Int64.
    For compatibility the "Integer" is kept currently on Int32, the register format from the X86 computers. 
    Older computers likewise the 8088 had an 8 bit Int and therefore that was the same as the byte.
    The 80286 had a 16 bits Integer.
    Success
    Cor

  • Select Query and Join Between int and Numeric(22)

    I have two tables
    tablea
    Field1 int
    tableb
    Field1 Numeric(22)
    I know this design is wrong but this is what I have ?
    tablea contains about 12M records
    Field1 in tablea is one to one related to Field1 in tableb
    Now I have Select Query
    Select tablea.* from tablea,tableb where tablea.field1=tableb.field1 and tableb.field2 > somrthing
    Query here is
    Does Join Between
    int type

    Yes, avinash said rightly.
    there is another way bit diffict.
    use the indexes properly as available in the mseg table and mkpf table even then it is diffcult
    else try using BAPI.
    some bapi will give the entire details of the MATERAIL DOCUMENT
    go to BAPI explorer tcode BAPI.
    where you can find the BAPI name like the 'GET_LIST'.
    Try this.
    hope this will serve your purpose.
    Thanks and regards
    Ramchander Rao.K

  • Random int and char

    I am developing a program that generates a SIP message. For the branch tag of Via header field i need to generate random mixture of integers and strings....sth like this (89hg823Hjkg8).
    I know how to generate int and string separately....but ive no idea how to generate the mixture of two. help
    thanx in advance

    You could use java.util.Random to generate random numbers from 48 to 122 inclusive and then cast it as a char. Only problem is that several of the numbers within this range represent other characters such as ? > @ etc.

  • Shared file system between Int and ext server(DMZ) in R12.1.3 for iRec

    Dear Friends,
    we are using R12.1.3 and we planned to use iRec module.
    so we decided to go with External web tier and it will be placed in DMZ for external users.
    Is it possible to have shared file system between internal and external web server when external server is in DMZ?
    Is it safe to go with shared application Tier file system between internal and external server (or) to have seperate file system in externel web tier?
    Regards,
    DB

    Take a look at Note 380490.1 DMZ Deployment for R12.
    Also For Specific Load balancer 727171.1 Up to 12.x but alot of the information is still usefull based on hardware loadbalancer
    Also Note 1309013.1 has some good information on SSO/OAM Intergration with E-Business Suite

  • Fastest way to access data between String and char[]

    Hi all,
    I've been programming a small String generator and was curious about the best and fastest way to do so.
    I've done it in two ways and now hope you can tell me if there is a "more java version" or fastest way between those two or if I'm totally wrong as some classe in the API already does that.
    Here are the codes:
    version 1:
            //describe the alphabet
         String alphabet = "abcdefghijklmnopqrstuvwxyz";
         //The "modifiable String"
         StringBuffer stringBuffer = new StringBuffer();
         //Just put the temporary int declaration outside the loop for performance reasons
         int generatedNumber;
         //Just do a "for" loop to get one letter and add it the String
         //Let's say we need a 8 letters word to be generated
         for (int i=0; i < 8; i++)
             generatedNumber = (int)(Math.random() * 26);
             stringBuffer.append(alphabet.charAt(generatedNumber));
         System.out.println(stringBuffer.toString());
         stringBuffer =null;version 2:
            //describe the alphabet
         char[] alphabetArray = {'a', 'b', 'c', 'd', 'e', 'f',
                        'g', 'h', 'i', 'j', 'k', 'l',
                        'm', 'n', 'o', 'p', 'q', 'r',
                        's', 't', 'u', 'v', 'w', 'x',
                        'y', 'z'}
         //The "modifiable String"
         StringBuffer stringBuffer = new StringBuffer();
         //Just put the temporary int declaration outside the loop for performance reasons
         int generatedNumber;
         //Just do a "for" loop to get one letter and add it the String
         //Let's say we need a 8 letters word to be generated
         for (int i=0; i < 8; i++)
             generatedNumber = (int)(Math.random() * 26);
             stringBuffer.append(alphabetArray[generatedNumber]);
         System.out.println(stringBuffer.toString());
         stringBuffer =null;Basically, the question is, what is the safest, fastest and more "to the rules" way to access a char in a sequence?
    Thanks in advance.
    Edited by: airchtit on Jan 22, 2008 6:02 AM

    paul.miner wrote:
    Better, use a char[] instead of a StringBuffer/StringBuilder, since you seem to know the size of the array in advance.
    Although I imagine making "alphabet" a char[] has slightly less overhead than making it a String
    1. It's a lot clearer to write it as a String.
    2. You can just call toCharArray() on the String to get a char[], instead of writing out each char individually.
    3. Or if you're going to be using a plain alphabet, just use (randomNumber + 'a')
    And use Random.nextInt()Hello and thx for the answers,
    I know I shouldn't put constants in my code, it was just a piece of code done in 1 minute to help a colleague.
    Even if it was just a one minute piece of code, I was wondering about the performance problem on large scale calculating, I mean something like a 25 characters word for billions of customers but anyway, once again, the impact should be minimal.
    By the way, I didn't know the Random Class (shame on me, I still don't know the whole API) and, I don't understand why I should be using this one more than the Random.Math which is static and thus take a few less memory and is easier to call.
    Is it because of the repartition factor?
    According to the API, the Random.Math gives (almost) a uniform distribution whether the Random.nextInt() gives a "more random" int.
    I

  • Photo operations between iPad and PC

    I'm a PC guy who has just purchased an iPad for travel.  Here's what I want to be able to do:
    Take pictures with my iPhone or Canon.
    Move those pictures to the iPad.
    Edit the pictures on the iPad.
    Add keywords to the pictures.
    After the trip, move the pictures to the PC.
    Here's what I've done so far:
    Ordered the camera connection kit which should allow me to copy pictures off the camera onto the iPad
    Purchased the Photo transfer App which permits me to copy pictures from the iPhone to the iPad and from the iPad to the PC.
    Keywords appear to be out of my reach.  I know iPhoto supports them, because I found that feature on my wife's Mac.  But iPhoto for iPad does not appear to allow you to add, view or search by keywords.  Is that correct?
    I'm a little concerned about what the iPad is doing to the photo files.  Using iTunes, I downloaded several albums from Photoshop Elements onto the iPad and using Photo Transfer, I attempted to send one of these photos back to the PC.  I compared the original photo with the photo that made the round trip and found that:
    It had been renamed.
    The keywords that I had attached to the photo in either Windows 7 or Elements had been stripped from the file but properties like Date Taken were preserved.
    The dimensions were preserved (3456 x 2304) but the file had shrunk from 2.52 MB to 1.46 MB.  Some of that can be accounted for by the stripping of keywords, but that would represent hundreds of bytes, not over a megabyte.  What went missing?
    Any ideas on how to apply and/or preserve keywords on the iPad?

    The camera connection kit can only be used to import photo/video files form a camera, SD card or USB flash drive. You can't import other types of files. You can't export any type of files using the camera connection kit.
    On your Canon camera, you may have to do this to import pics from the camera. Switching from Picture Transfer Protocol (PTP) [Some cameras may refer to PTP as Pictbridge or PTP/Pictbridge.] to Mass Storage Device Mode or vise versa on the camera.
    These links may be helpful.
    How To Create Photo Albums http://tinyurl.com/cxm4eoq
    How to Add New Albums in the Photos App on the iPad & Add Photos to the Album
    http://tinyurl.com/7qep7fs
    Importing Personal Photos and videos from your iOS device to your computer.
    http://support.apple.com/kb/HT4083
    Copy Photos (& Videos) Between iOS Devices
    http://tinyurl.com/cnz95bc
    Expand your iPad's storage capacity with HyperDrive
    http://www.macworld.com/article/1153935/hyperdrive.html
    On the road with a camera, an iPad, and a Hyperdrive
    http://www.macworld.com/article/1160231/ipadhyperdrive.html
     Cheers, Tom

  • Comparision Document between PI and Informatica.

    Hi All,
            I have requirement where the current Informatica system is being replaced by PI. I would like to present .PPT to my client showing the comparison of operations between PI and Informatica. I would like to show pros and cons of both PI and Informatica. Request to provide me any useful document mentioning so.

    Hi,
    Please check below link.
    SAP PI 7.1 in what way it can replace an ETL tool like Informatica?
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/10fbac70-c381-2d10-afbe-c3902a694eaf?quicklink=index&overridelayout=true
    In addition you can refer below link as well
    Re: SAP PI 7.1 or 7.3 vs webMethods,Oracle Fusion,Biz talk, Tibco,IBM websphere
    Regards,
    Deepak.

  • Char int and println MeSS, help plz any1??

    Hello dear people.
    Well, homework assignment was to write a code which will output the alphabet parallel a-z , A-Z
    using a for-loop
    so.... her's what i wrote:
    public class buha {
         public static void main(String[] args) {
              for (int nm=65; nm==90; nm+=1){ //A=65, Z=90, this is a numerical
                                             //presentation of the alphabet
                   char g=(char)nm;           //g for the capital letters
                            char k=(char)(nm+32);     //k for the small letters, 32 is
                                            //the difference between small and capital
                             System.out.println(g, ' ', k); //this show output capital, few spaces
                                            //and small.
    }Why isn't it working?
    Compiler shows an error with the println
    thanks allot, Amit

    thank you for your posts.
    i fixed the code as Sabre offeres (is the second expression in a for loop functions as a while condition or as an end condition?)
    now it looks like that:
    public class buha {
         public static void main(String[] args) {
              for (int nm=65; nm<=90; nm+=1){ //A=65, Z=90, this is a numerical
                                             //presentation of the alphabet
                   char g=(char)nm;           //g for the capital letters
                            char k=(char)(nm+32);     //k for the small letters, 32 is
                                            //the difference between small and capital
                             System.out.println(g, "  " , k); //this show output capital, few spaces
                                            //and small.
    }and still showing the same problem about the println, namely:
    The method println(char) in the type PrintStream is not applicable for the arguments (char, String, char)
    ideas?

  • 7344 servo motion switching between open and closed loop operation

    I have a custom end-of-line test system presently using a 4-axis 7344 servo controller to perform various functional tests on small, brushed DC motors. The system is programmed in C/C++ and uses flex motion functions to control the motor during testing. Motors are coupled to external encoder feedback and third party PWM drives running in closed-loop torque mode from an analog command signal. The system uses all four motion axis channels on the 7344 board to independently and asynchronously test up to four production motors at a time.
    In closed-loop mode, the system runs without issue, satisfying the battery of testing protocols executed by this system. I now have a request to add additional test functionality to the system. This testing must be run in open loop mode. Specifically, I need to use my +/- 10v analog output command to my torque drive to send different DAC output levels to the connected motor.drive while monitoring response.
    I do not believe the flex motion library or 7344 controller includes functions to easily switch between open and closed loop mode without sending a new drive configuration. I am also under the impression that I cannot reconfigure one (or more) servo controller axis channels without disabling the entire drive. As my system runs each axis channel in an asynchronous manner, any requirement to shutdown all drives each time I change modes is an unworkable solution.
    I am open to all ideas that will allow asynchronous operation of my 4 motor testing stations. If the only solution is to add a second 7344 controller and mechanical relays to switch the drive and motor wiring between two separately configured servo channels, so be it. I just want to explore any available avenue before I place a price tag on this new system requirement.
    Bob

    Jochen,
    Thank you for the quick response. The 7344 board does an excellent job running my manufacturing motor assemblies through a custom end-of-line tester in closed loop mode. A portion of the performance history and test result couples the motor through a mechanical load and external shaft. The shaft is in contact with a linear encoder that closes my servo loop.
    My new manufacturing requirement is to also sample/document how the small DC motor behaves in open loop operation. Your solution is exactly what I need to perform the additional functional tests on the product I am manufacturing. I see no reason why this cannot work. I was originally concerned that I would need to reinitialize the 7344 board after changing axis configuration. Initialization is a global event and impacts all four channels on the 7344 board.
    Using flex_config_axis() to change axis configuration on a single channel without disturbing other potentially running axis channels will solve my concern. It will be several weeks before I can return to the manufacturing facility where the 7344-based testing machine is located. I will update this thread once I verify a successful result.
    Bob

  • RE : Drag and Drop operations between two outlinefields

    Hi,
    Has any one tried the drag and drop operations between two Outline widgets ina
    window.Any help appreciated.
    Thanks
    balsubHi Balsub,
    Here are some lines which can help you :
    First of all, your 2 OutLineFields must be in a draggable state.
    In the event loop of your window, you have to listen to the event
    ObjectDrop
    on the 2 OutLineFields :
    When Self.<MyOutLine1>.ObjectDrop(SourceX = SourceX,
    SourceY = SourceY,
    SourceField = SourceField,
    TargetX = TargetX,
    TargetY = TargetY,
    TargetField = TargetField) do
    When Self.<MyOutLine2>.ObjectDrop(SourceX = SourceX,
    SourceY = SourceY,
    SourceField = SourceField,
    TargetX = TargetX,
    TargetY = TargetY,
    TargetField = TargetField) do
    Then, when you receive this event, the LocateNode() method will give you
    the DisplayNode which is beeing dragged :
    (assume that your OutLineFields are mapped to the class named :
    ClassOutLine,
    and Col is an Integer which is not important here)
    TheSourceLine : ClassOutLine;
    Col : Integer;
    TheSourceLine = (ClassOutLine)((OutLineField)(SourceField).LocateNode(X
    = SourceX,
    Y = SourceY,
    Column = Col));
    If you want to remove this line from the Source OutLineField :
    TheSourceLine.Parent = Nil;
    TheSourceLine.UpdateFieldFromData();
    If you want to insert this line at the end of the Target OutLineField :
    TheSourceLine.Parent = (OutLineField)(TargetField);
    TheSourceLine.UpdateFieldFromData();
    And if you want to insert this line before or after the Target line of
    the Target OutLineField :
    TheTargetLine : ClassOutLine;
    TheTargetLine = (ClassOutLine)((OutLineField)(TargetField).LocateNode(X
    = TargetX,
    Y = TargetY,
    Column = Col));
    TheTargetLine.PrevSibling = TheSourceLine; // Insert the source line
    before the target line
    or
    TheTargetLine.NextSibling = TheSourceLine; // Insert the source line
    after the target line
    TheTargetLine.UpdateFieldFromData();
    I hope this help you !
    - Manuel -
    Manuel Deveaux
    Forte Developer
    Mutuelle Pr&eacute;viade
    FRANCE
    E-Mail : [email protected]
    -----------------------------------------

    There is no configuration for it. It should work.
    Can you try it in a different user account. If it works in a different account, then it is likely something in your current user account that is messed up. If it doesn't work in another user account, then it is likely something with Mail, itself. 
    You could try downloading and installing the 10.6.7 combo update. That may repair what is wrong.

  • Does anyone know if there is a way to share files between Mavericks and Mac OS 9.1 operating system?

    Does anyone know if there is a way to share files between Mavericks and Mac OS 9.1 operating system? When I try to connect from my iMac I get a window that says "The version of the server you are trying to connect to is not supported." Is there a work-around to this problem or is it just not possible? It would be largly appriciated for a solutin beings my business is a small town newspaper, and we have some important files on the older computer that need to be acessed daily.

    Actually to share files between OS 8-9 and OS X, all versions, is quite easy from what I read. Look here for some details.
    http://reviews.cnet.com/8301-13727_7-20003464-263.html
    And here.
    https://www.google.com/search?q=file+sharing+Mac+OS+9.x&oq=file+sharing+Mac+OS+9 .x&aqs=chrome..69i57.20706j0j1&sourceid=chrome&ie=UTF-8
    Or since both OS 9 and OS X can do SMB Windows sharing you could use that protocol to share files from one to the other.
    Doesn't really matter what OS you are using. Mac OS/OS X shar files with Windows computers of all types and versions of Windows so the same applies for the different versions of Mac OS/OS X.
    Each Operating System takes care of reading and writing files to there respective file formats of the hard drives so that does not have to be the same. They both just have to be able to do Ethernet with the same files sharing protocol.

  • Overloading ambiguity between "std::pow(double, int)" and "std::pow(long do

    hello all,
    we have a problem with sources coming from visual c++, i can reproduce the problem with the small code:
    $ cat test.cc
    #include <math.h>
    int main()
    double kk;
    int j11;
    j11=4;
    kk=pow(2,j11);
    $ CC test.cc
    "test.cc", line 8: Error: Overloading ambiguity between "std::pow(double, int)" and "std::pow(long double, int)".
    1 Error(s) detected.we are on linux, with sun studio 12u1
    thanks in advance for help,
    gerard

    The issue is whether the standard headers associated with the compiler have the overloads required by the standard. If the required overloads are present, the original call of std::pow is ambiguous, and the compiler will report it.
    If you have a recent version of Visual C++, I'd be very surprised if the function overloads were not available. Possibly you are using a compiler option, perhaps a default option, that hides the overloaded declarations. In that case, some C++ code that conforms to the standard would not behave correctly when used with the compiler in that mode.
    The correct approach is to use the compiler in standard-conforming mode so that code you write will be accepted by other standard-conforming compilers. That is, after all, the purpose of the standard.

  • Regarding - Drag and Drop operations between two outlinefields

    Hi,
    Has any one tried the drag and drop operations between two Outline widgets in a window.Any help appreciated.
    Thanks
    balsub

    There is no configuration for it. It should work.
    Can you try it in a different user account. If it works in a different account, then it is likely something in your current user account that is messed up. If it doesn't work in another user account, then it is likely something with Mail, itself. 
    You could try downloading and installing the 10.6.7 combo update. That may repair what is wrong.

  • Difference between concat and concatenation operator ||

    Hi,
    Most of us may think there is no difference between CONCAT and ||
    By looking in the doc, I can read
    This function is equivalent to the concatenation operator (||). The function is useful when there are spaces in the values to be concatenated. The concatenation operator does not permit spaces.
    <URL:SQL Reference>
    I cannot find a query with a difference, can you?
    SQL> select 'a '||' b',concat('a ',' b') from dual
    'A'||'B' CONCAT('A','B')
    a  b     a  bThanks for feedback
    Laurent

    Thanks APC, this is ok, I understand the platform independance of concat over || . It is also mission impossible to type || on some prehistoric/foreign keyboards/terminals.
    I will write in the docu feedback forum that
    CONCAT: The concatenation operator does not permit spaces.
    concatenation operator: Trailing blanks in character strings are preserved by concatenation
    are not clear, or even contradicting themselves.
    Best regards
    Laurent

Maybe you are looking for