~ operator in java

Can you show me example how to use this operator?

This is a result of using 2's complement notation so that negative numbers can be represented. A signed number starts with 0 for positive numbers and 1 for negative numbers. To change sign, invert the bits and add 1:
127 is 0111 1111
3 is 0000 0011
2 is 0000 0010
1 is 0000 0001
0 is 0000 0000
-1 is 1111 1111
-2 is 1111 1110
-3 is 1111 1101
-4 is 1111 1100
-128 is 1000 0000
Here's more information:
http://courses.cs.vt.edu/~cs1104/BuildingBlocks/Chapter4.070.htm

Similar Messages

  • Binary operations in Java

    Hi,
    are there any binary operations in Java like '&' in C? I didn't found any information in the API description.
    Thank u.

    You didn't find them from the API since they are a feature of the language. Try the langspec instead: http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#5228

  • OSB11134:the service is not testable since all its operations require Java

    I was trying to Invoke the OSB Proxy service from weblogic Launch Test Console....but "Launch Test Console" icon is disabled.
    it shows the message *"the service is not testable since all its operations require Java arguments""* when I move cursor on top of the icon
    I am using OSB 11.1.3.4.
    Can some one help on this?
    Thanks in Advance.
    AB

    Export your project and send the exported jar to my id. By default, the name of exported jar is sbconfig.jar
    http://download.oracle.com/docs/cd/E17904_01/doc.1111/e15867/import_export.htm#CIHHEJFJ
    Regards,
    Anuj

  • Command line operations in java

    hi there,
    is it possible to create a java program that can perform a specified command line operation?
    regards

    hi there,
    is it possible to create a java program that can
    perform a specified command line operation?
    regardsYes, thats what the String[] args in public static void main(String[] args) is for.

  • Invoke a FTP "Get File" operation throws java.lang.ClassCastException:

    Hi there,
    I am working on a very simple sample project that will pull the file from a ftp site. I create a partner link with FTP adpater with "Get File" operation.
    When I deploy and run the SIMPLE project, it throws the following exception.
    I am wondering if any of you experienced the same problem and how to resolve the issue. Your help will be greatly appreciated.
    Here is the error message:
    <messages><input><Invoke_1_Get_InputVariable><part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Root-Element"><Root-Element xmlns="http://TargetNamespace.com/ftp_service"/>
    </part></Invoke_1_Get_InputVariable></input><fault><bindingFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="summary"><summary>file:/C:/product/10.1.3.1/OracleAS_1/bpel/domains/default/tmp/.bpel_FTPProcess2_1.0_709914d835a81c407ed668866e080b9e.tmp/ftp_service.wsdl [ Get_ptt::Get(Root-Element) ] - WSIF JCA Execute of operation 'Get' failed due to: Could not instantiate InteractionSpec oracle.tip.adapter.ftp.inbound.FTPActivationSpec due to: oracle.tip.adapter.ftp.inbound.FTPActivationSpec; nested exception is:
         java.lang.ClassCastException: oracle.tip.adapter.ftp.inbound.FTPActivationSpec; nested exception is:
         org.collaxa.thirdparty.apache.wsif.WSIFException: Could not instantiate InteractionSpec oracle.tip.adapter.ftp.inbound.FTPActivationSpec due to: oracle.tip.adapter.ftp.inbound.FTPActivationSpec; nested exception is:
         java.lang.ClassCastException: oracle.tip.adapter.ftp.inbound.FTPActivationSpec</summary>
    </part><part name="detail"><detail>org.collaxa.thirdparty.apache.wsif.WSIFException: Could not instantiate InteractionSpec oracle.tip.adapter.ftp.inbound.FTPActivationSpec due to: oracle.tip.adapter.ftp.inbound.FTPActivationSpec; nested exception is:
         java.lang.ClassCastException: oracle.tip.adapter.ftp.inbound.FTPActivationSpec</detail>
    </part></bindingFault></fault></messages>

    Take a look at the stack trace, it shows you exactly where the error is coming from:
    java.lang.ClassCastException: org.theclass.candidate.view.SearchForm
    org.theclass.candidate.view.CandidateListAction.execute(CandidateListAction.java:41)Line 41 in your CandidateListAction.
    Probably it is failing on a cast of your action form.
    Taking a closer look at your struts-config, you are "chaining" actions.
    Your AddCandidateAction uses the candidateForm, and forwards to CandidateListAction.do
    Your CandidateListAction uses the searchForm.
    That will be the cause of your class cast exception.
    <action path="/Add"
      name="candidateForm"
      type="org.theclass.candidate.view.AddCandidateAction"
      validate ="true"
      input="/jsp/addcandidate.jsp">
      <forward name="success" path="/CandidateList.do"/>
    </action>
    <action path="/CandidateList"
    type="org.theclass.candidate.view.CandidateListAction"
    name="searchForm"
    scope="request" >
    <forward name="failure" path="/jsp/list.jsp"/>
    <forward name="success" path="/jsp/candidatelist.jsp"/>
    </action>Check out: http://struts.apache.org/1.x/faqs/newbie.html#chaining
    Solutions?
    - don't chain actions ;-)
    - use the same action form for both actions (possible?)
    - make the actionForward a "redirect" one. That means a new request, and losing any request parameters/attributes but should prevent this class cast exception.
    Hope this helps,
    evnafets

  • How to overload = operator in Java?

    Like String s = "somestring" or Integer i=10, how to develop a class with '=' operator overloaded?
    For example
    MyClass obj = 12.3f;(similar to Float class)

    I understand the answer. But how are these classes
    like String, Integer and other wrapper classes built
    for = operator overloading? Is this accomplished
    using native code?It's just how the language is defined. [url http://java.sun.com/docs/books/jls/third_edition/html/j3TOC.html]The JLS defines how these operators are required to behave. The compiler interpets them as per the JLS, to generate the proper bytecodes.

  • Opera 9, Java, and NY Times Sudoku

    I'm having a hard time loading the NY Times Sudoku page with Opera 9 under Arch Linux. It is obviously a Java problem, and I don't seem to have this problem under Fedora Core 5 running jre 1.5.0 there.
    To find that page, load nytimes.com, then choose the Crossword/Games link in the left column. Then choose the Sudoku link in the body of the page.
    My experience under Arch is that the page either locks up Opera 9 or crashes it.

    Titus wrote:
    in extra repo there is 9.02 build
    extra/opera 9.0-2 The Opera web browser
    That's opera 9.0 but the pkg has pkgrel 2, you're kinda confused
    A package of the weekly build is here

  • I want a delete operator in Java. Why not?

    The idea is simple: when I tell "delete some_object;" the system checks if the object can be deleted.
    a) Object is not referenced by any other objects out of the reference cycle *=>* some_object object calls its destructor and then it is deleted, and the same should happen to all objects in the reference cycle. The reference some_object is set to null, as operator delete returns null.
    b) Object is referenced by some other objects, which are not in a cycle of references, ending up at the some_object object itself *=>* some_object object is not deleted (destructor is not called), but the reference some_object is set to null (operator delete returns null) and the reference count of the some_object object (in the system) is decreased by 1.
    Easy.
    Why not?

    grinice wrote:
    b) Object is referenced by some other objects, which are not in a cycle of references, ending up at the some_object object itself *=>* some_object object is not deleted (destructor is not called), but the reference some_object is set to null Makes no sense. There can be multiple references to a given object, and you don't always own all of them. If you want to set one to null, you can already do that with ref = null;
    Easy.If it's that easy, create your own language that does it.
    Why not?Why?

  • BitWise Operations in java

    hi Guys
    Can any one help me out in explaining the below program
    public class Bitwise{
    public static void main (String[]args){
    int x=12&13;
    int y=x^6;
    System.out.println(y I 3)
    Pls help me with the above program in detail explanation
    Raghu

    Here's a better idea. You start by:
    1) adding print statements to print out x and y immediately after they're set.
    2) predicting what you think each print statement will produce, consulting your favorite text or tutorial (see below links) or the JLS if you need to.
    3) running the program.
    4) seeing if the results match what you expected.
    5) trying to figure why they didn't match, if they didn't.
    6) poting a specific question here about what you expected and why, and what you saw instead, if you're unable to figure it out.
    Installation Notes - JDK 5.0 Microsoft Windows (32-bit)
    Your First Cup of Java
    New to Java Center
    The Java&#8482; Tutorial - A practical guide for programmers
    The Java&#8482; Tutorial - Trail: Learning the Java Language
    Java Programming Notes - Fred Swartz
    How To Think Like A Computer Scientist
    Introduction to Computer Science using Java
    The Java Developers Almanac 1.4
    Object-Oriented Programming Concepts
    Object-oriented language basics
    Don't Fear the OOP
    Books:
    The Java Programming Language - 4th Edition
    Head First Java, by Bert Bates and Kathy Sierra
    Thinking in Java (Free online), by Bruce Eckel
    Core Java, by Cay Horstmann and Gary Cornell
    Effective Java, by Joshua Bloch
    http://java.sun.com/developer/Books/javaprogramming/
    Intermediate
    The Craftsman Series
    Java Design: Building Better Apps and Applets (2nd Edition)
    Head First Design Patterns

  • Writing own 3D reflection operation in JAVA

    Hi,-
    i am not sure i should ask this in this forum.
    i did not know where to ask but here.
    does anybody know any open source/algorithm on 3D reflection
    wrt an arbitrary 3D line?
    best regards

    My comments below.
    thanks much.
    all right, let me post this question this way:
    can someone express 3D reflection about any linein
    terms of 3D rotation and translation functions of
    JAVA3D?
    thanks muchIf I understand cotrectly, a reflection about a line
    in 3D space is essentially the same as a rotation
    about that axis (note this does not hold true for
    reflection about a point or reflection about a
    plane).
    yes, totally agree.
    there will be 7 steps as mentioned in
    http://astronomy.swin.edu.au/~pbourke/geometry/rotate/
    however, i think step 4 must have theta = pi radians (i.e., 1800 degrees), right?
    So all you need to do is rotate about that line. In
    Java 3D, look into the AxisAngle class or the
    Quaternion class (kinda the same thing, but more
    powerful, and more complicated).
    ok.
    In general, to get the formula for the rotation
    matrix for rotation about an arbitrary vector,
    wikipedia has a decent article:
    http://en.wikipedia.org/wiki/Rotation_matrix
    look for the formula for M(v, theta).
    this does not help. i found that site before.
    - Adam

  • Intersection Operation in Java?

    Is my observation correct that the 11g Java API (JGeometry et al) does not contain support for calculating the intersection of 2 geometries? If so, is there a work around? If not, can someone point me to a published algorithm for performing an intersection?

    user13253802 wrote:
    I' a newbie in Java, I have a problem to manipulate an array of int, I have an array like this :
    I do not know how to do it in loop, can anyone help me? thanks...I agree with Kayaman, but here's a few tips:
    1. Don't forget that array indexes start at 0, not 1.
    2. If you want to do it in a loop, think about what you're trying to do and how it might fit into a formula. Imagine what 'anArray' would look like if it had 3 more numbers in it ... or 6 or 9. What would you want to do then?
    3. Put your results in a new array; don't overwrite 'anArray' . What do you think this result array should look like? How big should it be?
    4. Write out your solution in English (or your native language) before you start coding*.
    HIH
    Winston

  • Date operations in java: how to substract two dates

    dear all
    I want to substract two date and return the number of days between them
    and I want to make a method that return the number of monthes between two dates
    please help

    Kayaman wrote:
    Check out the Calendar class.Hello Kayaman,
    From a quick glance at its API, I haven't found it obvious that Calendar could fulfill such need under 10-lines algorithms. As per Joda-time's proponents, it's one of those computation that are unintuitively hard or convoluted using the stock JDK date&time classes.
    If you're comfortable with Calendar, maybe you'd find it interesting to voice your opinion in this other topic: {thread:id=1982257}. Thanks in advance.
    Hello OP,
    apologies for plugging that discussion in your topic. But I do think it's closely related.
    I noticed you marked both replies as helpful. I'd like to know your feedback on those replies: have you tried both approaches, and succeed with one, or both? Have you met difficulties with either?
    Thanks, and good luck anyway.
    J.

  • The ? : operator in Java

    if is possible , how can I change the following code to it is shortcut like (a > b) ? a : b;
    if ((flag == true))
    nestedTable.addCell(cL11);
    else{
    Paragraph cL16= new Paragraph("", smallFont);
    cL16.setAlignment(Element.ALIGN_JUSTIFIED);
    cL16.add(sp);
    cL16.add("Due Date: ");
    cL16.add(space);
    cL16.add(continueDue );
    nestedTable.addCell(cL16);
    }

    nestedTable.addCell(flag ? cL11 : new Paragraph("", smallFont) {
                    setAlignment(Element.ALIGN_JUSTIFIED);
                    add(sp);
                    add("Due Date: ");
                    add(space);
                    add(continueDue);
            });Disclaimer : I wouldn't use the above piece of code . Would much rather prefer readability .

  • Java and binary operations (roll)

    Is there any roll operations in java?
    1011 rolled to the right would become 1101
    1011 rolled to the left would bcome 0111
    How can I accomplish this?

    Why do you need that?I'm making a huffman encoder and need binary paths. I shift individual paths into a long path, but when an individual path exceeds the total number of bits I need to store the highest bits into the remaining of the path. Its easier to mask the lower segment than the higher in a collection of bits, so I would like to roll the path to the high bits end up at the lower part of the path and then mask the path so it contains a correct number of bits and shift it into the remaining bits.
    example:
    current path - 10110010110010000
    path - 1000
    notice the three last bits (000). This is where I want to 'store' 1000. Since 1000 is four bits I need to take the 3 highest bits (100) store these and store the last bit in a new long path. I can mask the lowest by doing 'path &= ((int)Math.pow(2, bit) - 1)' but this is not possible with high bits.
    Nille

  • Still got problems with java class business operations

    Hi all,
    I've read the latest on business operations and java class files, but my problem
    remains - the workaround of putting the class file in the studio classpath did
    not work for me.
    To breifly recap the problem -
    I am unable to assign an instance variable when trying to call a predefined business
    operation of a java class. Calling the constructor seems to work okay and I can
    assign the result to a variable of type "java object" but that's as far as it
    goes. If I try placing the class file in the studio classpath, my "Instance Variable"
    dropdown list dims, but I am still prompted to choose one when I press okay.
    I'm using process integrator 2 sp2 on wls6.
    Please help!
    Regards
    Andrew

    Still no good. I'm running my testing on my own PC with windows 2000. Maybe a
    windows bug rather than a remote bug?!
    Anyone else have a suggestion?
    "Soteri Panagou" <[email protected]> wrote:
    >
    Andrew
    What platform are you running on?
    I have found the same problem when trying to run wlpi remotely.
    We have a sun box with the WLI installation. When i run wlpi on that
    box, and
    do the business operation configuration as u describe below, i get instance
    variables
    populated in the drop down box of the business operation window. I can
    then select
    the java object my instance is assigned to.
    However, when i connect remotely using the studio and try to view the
    business
    operation settings, nothing appears in the instance drop down box.
    When i go back to the console and run the studio on the same machine
    as the installation,
    the instance variable drop down is populated once again.
    So all i can say is, configure the workflow on the machine have the running
    installation,
    and then it should work. It did for me :)
    Hope this helps
    Steri
    "Andrew" <[email protected]> wrote:
    Hi all,
    I've read the latest on business operations and java class files, but
    my problem
    remains - the workaround of putting the class file in the studio classpath
    did
    not work for me.
    To breifly recap the problem -
    I am unable to assign an instance variable when trying to call a predefined
    business
    operation of a java class. Calling the constructor seems to work okay
    and I can
    assign the result to a variable of type "java object" but that's asfar
    as it
    goes. If I try placing the class file in the studio classpath, my "Instance
    Variable"
    dropdown list dims, but I am still prompted to choose one when I press
    okay.
    I'm using process integrator 2 sp2 on wls6.
    Please help!
    Regards
    Andrew

Maybe you are looking for