Problem with bits operation

Hi
I have the next code that is throwing the
recorreBits.java:8: possible loss of precision
found   : int
required: byte
  byte c =        a & b;
                         ^
1 errorand the code is
public class recorreBits {
     public static void main(String args[])
     byte a = 0x20;
     byte b = 0x10;
     byte c = a & b;
     System.out.println(c);
          }I'm using byte don't know whyt it found's a int. Thanks
Edited by: Ikim on Oct 6, 2009 1:14 PM

[JLS 15.22.1 Integer Bitwise Operators|http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.22.1] says:
When both operands of an operator &, ^, or | are of a type that is convertible (§5.1.8) to a primitive integral type, binary numeric promotion is first performed on the operands (§5.6.2). The type of the bitwise operator expression is the promoted type of the operands.
So, since byte is a primitive integral type, binary numeric promotion occurs, and both are converted to int, and the result is then int. You can't assign an int value to a byte variable, unless it's a compile-time constant, so you have to cast.
byte c = (byte)(a & b);Edited by: jverd on Oct 6, 2009 1:19 PM

Similar Messages

  • Problems with Sequence Operator in OWB

    Hi everybody,
    i want to use a sequence in my mapping. Now i have two problems.
    The first problem is the following. When i want to import my sequence (exists on my DB) i can select the sequence in the Selection Window, but when i click on Import i didn't see it in the Design Center, also there is no window which tells me that i have successfully imported the sequence.
    The second problem is, when i drag the Sequence Operator into my Mapping i shows the Selection Window where i have to select the poject and object to bind the operator. But i can't select any object.
    Can anyone help me with my problems and tell me how i can use a Sequence and the Sequence Operator in my Mapping
    Many thanks in advance.
    Greetings

    Hi everyone!
    I'm having a repeated problem with sequences in OWB: I'm filling a TIME table with 1096 rows. Now matter how and when I create the sequence it always starts with 2 instead of 1. Moreover, the last value of the sequence is 1101, when it was supposed to be 1097 or 1098....
    I did achieve the right ouput sometimes, but I must be doing something wrong. Here are the several ways I've tried in OWB:
    1) I've created all the sequences by sql code, in SQL DEVELOPER or PLUS*, and then imported to OWB. Because of being imported, I didn't have to deploy each sequence. Then, I've connected (by drag and drop to the canvas mapping) the sequence I wanted with NEXTVAL (as I always do) attached do TIME_ID of table TIME;
    2) I've dropped and created, several times(as before), the sequences and never had problems..until now. I've also experimented creating, by scratch, the sequences just in OWB and then deploy them in Control Center. After this, deployed the mapping and executed, just like in 1).
    So, the difference lies on how I create the sequences and what are the correct steps to create, deploy (if needed), deploy the map and execute the map.
    This is insain and I really need this to work. I've tried so many ways....
    Could someone PLEASE help me with this? Any thoughts?

  • Problem with the operator less than or equal to in a weby query

    Hi all.
    The universe is a OLAP Universe
    When i created a query in webi and put the month in the filter area with the operator less than or equal to like this.
    Month (less than or equal to) 2010.01 for example. The all result brings also the all values like 2010.02, 2010.03, etc
    What is the problem and how can fix that ?
    Thanks

    Looks like you are using a less than or equal to with a Sting data type.
    I think you should change to your filter to Year <= 2010 And Month <= 1. Hope you have a month and year object in you BeX.
    Anil

  • Problem With mac Operating system

    ok, had a problem with a piece of software and was told to try and "downgrade" my OS. so i started an installer that was an installer to a previous system. i was on 4.8 and was trying to go to 3.4 i think. I got half way thru and it said start the installer again. restarted. instead of the apple logo coming up a round cross comes up. i connected to my comp thru another comp using the firewire but my user folder is empty. anyways i can find anything in the users folder and fix this problem? cheers

    Who told you to downgrade your OS X version and was this due to the software not being compatible with your OS X version which was 10.4.8?
    What software?
    Your computer detail provided indicates you have an Intel Mac and if so, you certainly cannot downgrade to 10.3 - any 10.3.x version. All Intel Macs have shipped with Tiger (10.4.x) pre-installed and there are no OS X versions prior to 10.4.x that is compatible with an Intel Mac and even if so, you cannot install an earlier or previous OS X version on a Mac that shipped with a later version.
    Unless you meant 10.4.3 which is the version that was pre-installed on your Intel Mac and the version included with the OS X install package that shipped with your Mac when new.
    Did this person who told you to downgrade your OS also tell you to be sure to create a backup or update your existing backup before doing so?
    Did you choose Archive & Install with an option to preserve user and network settings?
    If not and you choose Erase & Install, then your hard drive was completely erased first.

  • Problem regarding Bit operation

    I am currently trying new approach to speed up my current operation, for this I have to know the bit operations :-( but I am having trouble in finding the references for that.
    Can you please send me some references regarding bit operation.
    Thanks for taking keen interest in this post.

    By default, commit operation will save all rows to db. You can write update query in a button
    by taking jdbc connection reference from environment. After updating row in db you should
    refresh your ADF UI to see changes.
    You can use this code for creating db connection.
                    InitialContext initialContext = new InitialContext();
                    DataSource ds = (DataSource)initialContext.lookup("java:comp/env/jdbc/conDS");
                    --

  • Problems with bit shift left in Formula Node

    Hi,
    Sorry but my English is not good.
    I'm trying to execute a bit shift left in the Formula Node, but the shift left is not working as I expected.
    uInt32 parametro[5];
    float32 valorAmostra;
    int16 indiceAmostra;
    uInt8 indiceResposta;
    int16 controle;
    int32 valor;
    int8 i;
    for(i=0; i<5; i++)
    parametro[i]=param[i];
    valor = parametro[5]<<16 | parametro[4]<<8 | parametro[3];
    controle = parametro[1]<<8 | parametro[0];
    indiceAmostra = (controle & 0x3FF);
    indiceResposta = (controle >> 10);
    valorAmostra = valor & 0x7FFFFF;
    valorAmostra = valorAmostra*(2.4/8388607);
    if((valor & 0x800000) == 0x800000)
    valorAmostra = valorAmostra*(-1);
    the input param array is of the type uInt8, as I saw in other topics that does not shift with uInt8,
    I copy the values of param array to parametro which is of type  uInt32, but still did not work.
    Testing the input param with the following values:
    param[] = {10,14,10,0,16}
    the valorAmostra returned is 0,00117188 when he should be 0,300003.
    Can someone help me please?
    Solved!
    Go to Solution.

    Portuguese:
    Olá,
    Existe um bug no LabVIEW para esta operação. Este bug deverá ser corrigido em versões futuras. Uma solução para esta situação é utilizar um int32 ao invés de um ulnt32.
    Qualquer dúvida por favor entre em contato.
    Obrigado.
    English:
    I investigated the problem you are having, and it turns out that it is a bug that has already been reported and documented. The work around for it is to use int32 rather than uInt32.
    Thanks.
    Luciano Borges
    R&D Engineer
    Pirelli Brazil

  • Problem with bit rate ?

    Hi there,
    Using FCP7.
    After compressing a FCP project with Compressor and burning DVDSP with DVDSP, I realized that  scenes containing objects or people in rapid movement where showing jerked images.
    The slow motion scenes are fine.
    I checked the following
    settings for DVDSP burning: VBR two pass;
    averageBit rate  4,0,
    max rate 7,0
    1) the self-contained QT that I started with is not showing this problem.
    2) the m2v file obtained from compressor (I use preset setting for high quality compression) does not show this problem when I view it with MPEG streamclip
    3) I tried to burn directly the QT file  with Toast 10 …get same problem if not worse !.
    settings for Toast
    automatic re-encoding
    average rate 4,0 Mbps
    max bit rate 8,0 Mbps
    MPEG-2
    I guess my problem comes from the bit rate I used ?
    I am now confused and I am not sure I understood the impact of the bit rate setting on the quality of the resulting DVD, and I believe that using a high bit rate in DVDSP might result in problems for some clients to play the DVD on their player ?
    Could it be something else ?
    could someone please give me advice ?
    Many thanks in advance
    Ivan

    I can only think of two possibilities based on the info available:
    1. Old DVD player (choking on the bitrate spike)
    2. You need to set some compression markers around the scenes while in FCP. This would flag Compressor to pay extra attention to that area. After you output the new clip, I suggest you use the standard High Quality preset (in Compressor) for your program duration e.g., "Highest Quality 90 minute". Don't get creative with the encoding set-up. And ALWAYS used AC-3 audio.

  • Problem with zip operating system command

    Hello,
    i have the following configuration in the file receiver adapter:
    Directory: /tmp/
    File Name Scheme: %name%.txt
    Variable substitution:
    Variable Name: name                 Reference: payload: record,1,name,1
    Run Operating system command:
    /usr/bin/zip /tmp/%f.zip %F
    The execution is succesful, but i have a small problem. The file name is "file.txt.zip", the .txt should appear but i dont know how to skip it, I have tried so many ways but it doesnt work, I should receive a file called "file.zip" With a file inside in txt format...
    Thanks,
    Luis

    Hi Sriram,
    Thanks, but that wouldnt work out, Im using the %f for my file name, so this move command shouldnt work for me, because my filename changes in every execution, so I cant write something like this: mv file.txt.zip file.zip
    The only solution I see would would be a command which deals with strings and that could remove the four last characters of "%f"..but I havent found anything for doing it.
    Regards,
    Luis

  • Problem with pending operations after migrating to gw2014

    Hi there, this saturday we have migrated to gw2014 from gw2014. We are in a cluster environment.
    We only have one primary domain with one post office, all users are in this post office.
    We have several secondary domains for gwia/webaccess only.
    Mail flow is ok. Mails are coming in and coming out, but administrative message between domains
    are not flowing. For example: if I add a new account in the post office, I cant see this new account
    in secondary. Also, for creating new domains, etc. I dont know whats happening, all mta's are open
    in mta console from the primary. This is a very critical issue for me...
    Where I can debug this pending operations ? How can I know whats happening ? I dont know if I have
    a network issue / problem or its something related to GW system...
    please help!
    Antonio

    Something like that happened to me also. It turned out that the gw install did not copyed the dc files to the mta, poa directory. After copying the dc files manually, admin messages started to flow again.

  • Problem with define operation

    I have wsdl file (simple part of it here)
    <message name="otnAsyncServiceRequestMessage">
    <part name="peiSessionID" type="xsd:string">
    </message>
    <message name="otnAsyncServiceResultMessage">
    <part name="payload" type="xsd:string"/>
    </message>
    <portType name="otnAsyncService">
    <operation name="initiate">
    <input message="tns:otnAsyncServiceRequestMessage"/>
    </operation>
    </portType>
    And my process call async thi service using otn_jaxrpc.jar
    Here simple code from bpel file
    <assign name="assign-1">
    <copy>
    <from expression="ora:getConversationId()">
    </from>
    <to variable="otnAsyncServiceReq" part="peiSessionID"/>
    </copy>
    </assign>
    <invoke name="invokeOTNAsyncService" partnerLink="otn" portType="er2004:otnAsyncService" operation="initiate" inputVariable="otnAsyncServiceReq"/>
    <receive createInstance="no" name="receiveFromOTNCallBack" partnerLink="otn" portType="er2004:otnAsyncServiceCallback" operation="onResult" variable="otnAsyncServiceRes"/>
    .... i look at result throw tcpmon
    and soap envelope look like this
    </soapenv:Header>
    <soapenv:Body><peiSessionID xmlns="http://er2004.ifirst.ru"/></soapenv:Body>
    </soapenv:Envelope>
    But i have no peiSessionID operation in wsdl!
    And my service not define any operation with that name?!
    what's a problem!
    Help please!!!

    First, check if you have any calendar notes or appointments that you entered without a subject. Delete that note and try to sync.
    I hope this helps!
    Post relates to: Tungsten E2

  • Problem with IN operator

    I'm having a strange problem when using IN operator in a query. The following query works in one database which is 9i and does not work(not returning any rows) in another database which is 10g.
    select * from <table>
    where <column> IN
    (select <column> from <view>
    where <column> = <value>
    Another thing is if I replace the view with a table the query returns results in 10g. If I replace IN operator with a '=' the query returns results.
    The question is:
    Am i missing any default setting in database level? Why the query did not return any rows when I use view? Any ideas?
    Thanks in advance,

    Hi,
    I agree with Walter.
    REgarfds salim.
    SQL>  create view v_emp as select * from emp;
    View created.
    SQL> select * from v_emp;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-80        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
          7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
          7839 KING       PRESIDENT            17-NOV-81       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
    14 rows selected.
    SQL>
    SQL> select * from emp
      2  where empno in ( select empno from v_emp);
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-80        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
          7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
          7839 KING       PRESIDENT            17-NOV-81       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
    14 rows selected.
    SQL>

  • A possible problem with parallel operation?

    Hello everyone,
             I am working on a labview program that uses parallel execution, and I am running into a possible problem. Please bear with me, as sometimes it is difficult to explain things happening in Labview in text alone. This application reads data from a server that we have in one of our labs via an ActiveX component. This server is known as a TIU server. The server contains various data including part numbers, serial numbers etc. It sends this data out in three different signals. A sequence count, an ASCII high, and an ASCII low. The sequence counter sends data in the following manner. When the sequence count is 0 and both ASCII high and low are NULL, then a new part number sequence is about to begin. When the count sequence changes to "1", then the next two string charaters listed under ASCII high and ASCII low represent a number that is a "Function ID". There are several of these, and each function ID contains different information either a part number, a serial number, etc. Once this is read, and it is determined that you are looking at the correct Function ID, the next Count shows how many charaters are to follow, and then you read each set of two ASCII characters and concatenate them together until you build the entire ASCII sequence as one variable and the sequence is complete.
           There are several equipment cards attached to this TIU server, and each card is free wheeling it's data out. As soon as power is applied, it will continue to send out all of its function ID's sequentially (Function ID 0-9) in order, in a circular fashion at a 1 Hz. rate. A really strange system to be sure, but it is a limitation that I have to deal with. So now that I have laid a bit of the background on this, here is the problem. Occasionally, (maybe one out of 20 trys), the data seems to get slightly corrupted. For example, in the enclosed code, I ran it 40 times, reading the same part number each time. In theory, it should always be the same result. But it is not. I am wondering if there is an issue with running the "READ TIU SERVER.vi" in PreAllocated clone reentrant execution mode? Perhaps on occasion, one of the instances does not fully close, before another instance begins, and a few bits get flipped around? I suppose it is possible that occasionally the TIU server is actually putting out erroneous data (and I am actually reading everything perfectly), but it is a fairly mature system, and I have not gone down that path yet. I have included the .vi that I am using to read the server data "test.vi", and the "Read TIU Server.vi" that is set to Preallocated clone reentrant execution. In this example, the "test.vi" is only a single instance, but in the actual program, I am running 20-30 of these, as Preallocated clone reentrant execution as well. As there are 20-30 cards on each TIU server to get information from. I am hoping that this makes sense, and that I have laid it out in a logical fashion. Sort of hard to explain in text sometimes. Thanks for the help....
    Attachments:
    test.vi ‏123 KB
    Read Tiu Server.vi ‏15 KB

    Hi ,
          Thanks for taking a look. You caught me on the shift register, I had not gotten around to cleaning up a few things. However the "elapsed time" functions acutally are there on purpose. Unfortunately, it takes a VERY long time to get one of those part numbers, as only two ASCII characters are moved accross the bus at a 1 Hz. rate. I orginally had all wait statements, but I discovered that when you stop a while loop, it will continue until the wait timer has expired. With 20+ of these functions in parallel, it was taking upwards of 30 seconds for the program to finally end. From what I was reading on the forums of others that had that problem, a "elapsed time" function can be broken through, while a standard "wait" statement cannot. Now when I press the "STOP" button, the program ends almost immediately.
         This is not a standard piece of equipment that I am using, but I think the explanation is of how it works is fairly accurate. Would you have a guess as to why every so often the data gets corrupted? Other than the bus itself is actually putting wrong data out there? I suppose I should check that as well, but due to the slow rate of the bus, and the tools that we have, I will have to sit and watch it for a long time... Thanks...
    Dan

  • Problem with creating Operation with the BAPI_ROUTING_CREATE

    I try to create a routing with operations attached to the default sequence with the BAPI_ROUTING_CREATE, via an external rfc-program.
    I have no problems to transfer the Task Header und the MaterialTaskAllocation, but the transfer of the operation allways fails, without an error message. The system creates the Routing without any operation.
    Are there some additional fields needed for the tranfer of an operation, in the online documentation there is only
    the field OPERATION_ID defined as needed.
    Thank's for any help
    Jörg Sloksnaitis

    I'll share my code snippet since I got this kind of working this morning. The following code with hard-coded values works and is a fairly simple and straightforward Routing. This may be something you can build on.
    Task List Header
      w_bapi1012_tsk_c-VALID_FROM = sy-datum.
      w_bapi1012_tsk_c-VALID_TO_DATE = '99991231'.
      w_bapi1012_tsk_c-PLANT =  zzplant.
      w_bapi1012_tsk_c-LOT_SIZE_FROM = '1'.
      w_bapi1012_tsk_c-LOT_SIZE_TO = '99999999'.
      w_bapi1012_tsk_c-TASK_MEASURE_UNIT = 'EA'.
      w_bapi1012_tsk_c-TASK_LIST_STATUS = '4'.
      w_bapi1012_tsk_c-TASK_LIST_USAGE = '1'.
      append w_bapi1012_tsk_c to t_bapi1012_tsk_c.
    Material Fields
      w_bapi1012_MTK_C-material = zzmaterial.
      w_bapi1012_mtk_c-plant    = zzplant.
      w_bapi1012_mtk_c-VALID_FROM = sy-datum.
    w_bapi1012_mtk_c-VALID_TO_DATE = '99991231'.
      append w_bapi1012_mtk_c to t_bapi1012_mtk_c.
    Operation
      w_bapi1012_opr_c-ACTIVITY = '9000'.
      w_bapi1012_opr_c-CONTROL_KEY = 'RP02'.
      w_bapi1012_opr_c-WORK_CNTR = ' '.
      w_bapi1012_opr_c-PLANT = zzplant.
      w_bapi1012_opr_c-DESCRIPTION  = 'Test Operation'.
      w_bapi1012_opr_c-BASE_QUANTITY = '1'.
      w_bapi1012_opr_c-OPERATION_MEASURE_UNIT = 'EA'.
      w_bapi1012_opr_c-VALID_FROM = sy-datum.
      w_bapi1012_opr_c-VALID_TO_DATE = '99991231'.
      w_bapi1012_opr_c-DENOMINATOR = '1'.
      w_bapi1012_opr_c-NOMINATOR = '1'.
      append w_bapi1012_opr_c to t_bapi1012_opr_c.
    Thanks,
    Tim Stadler
    Menasha Corporation

  • Satellite A100 - problem with battery operation

    Hi!
    My notebook (I bought it 1.5 years ago) has a big problem when operating with battery.
    First of all, with a fully charged battery, the notification for "limited battery status" pops up after 2 minutes of operation and after 5 minutes it goes to stand-by mode due to very low battery level.
    Then, I plug it on the AC power and the LED for the battery remains yellow for about 15 minutes and then turns blue.
    (The battery is OK, I have tested it on another Sat A100)
    What can be the problem???
    Thanks in advance!
    Maria

    Since You Have tested the battery in another Sat A100 the problem must be in your computer settings:
    1>> START >> CONTROL PANEL>> SELECT POWER OPTIONS ICON
    2>> You will now see a screen wich displays your power plans and note *one of them* has a tick i.e a small dot in a circle:
    3>> BALANCED > POWER SAVER> HIGH PERFORMANCE
    4>> UNDER THIS POWER PLAN > CLICK CHANGE PLAN SETTINGS> A SCREEN WILL BE DISPLAYED SHOWING YOUR PLAN!
    5>> PROCEED TO >> *CLICK* WHERE IT SAYS CHANGE ADVANCED POWER SETTINGS
    6>> IF YOU SCROLL THE BAR TO THE *+ SIGN >> BATTERY* CLICK THE *+ SIGN
    7>> YOU SHOULD HAVE : You will have to have play with these settings or you could click restore plan defaults to see if this will solve your problem
    Note clicking the *+ SIGN next to tany of these options below will allow you to change what event takes place on your computer.
    + CRITICAL BATTERY ACTION
    + LOW BATTERY LEVEL
    + CRITICAL BATTERY LEVEL
    + LOW BATTERY NOTIFICATION
    + LOW BATTERY ACTION

  • Problem with crude operations in master detail tables

    Hi,
    I have Master-Detail tables in my page and crud operations are there for both the tables. Create/delete/edit are working fine on the master table but i am facing the following problems for the detail table
    1.delete operation is alway referring to the 1st record.
    2.Edit operation is working fine for the 1st time but when i amt trying to edit any other record it's refer to the previous record, if i did the same again then it's pointing to current record.
    Selected row keys and selectionListner and row selection is defined on my detail table as shown below.
    selectedRowKeys="#{bindings.CmSubscriberTerritoryXrefView1.collectionModel.selectedRow}"
    selectionListener="#{bindings.CmSubscriberTerritoryXrefView1.collectionModel.makeCurrent}"
    rowSelection="single"
    Please do need full.

    Hi,
    Thanks for your quick reply.
    I am using JDeveloper 11g. Yes i select the record, i am using a popup for delete operation so i write a button which invoke popup in that popup i am asking confirmation like do you wanted to delete for not. in the OK button i have return logic like
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding =
    bindings.getOperationBinding("Delete2");
    Object result = operationBinding.execute();
    if (!operationBinding.getErrors().isEmpty()) {
    return null;
    operationBinding = bindings.getOperationBinding("Commit");
    result = operationBinding.execute();
    if (!operationBinding.getErrors().isEmpty()) {
    return null;
    FacesContext fc = FacesContext.getCurrentInstance();

Maybe you are looking for