Combine two ints into a long without using chars or strings.

Hi
I have two ints and i need to combine (not add) them into a long value. The reason for this is because I need the make keys for a DB containing both values.
eg.
int1 = 3567453647
int2= 6368535795
long combination = combine(int1, int2);
and the value of combination should be 35674536476368535795
I know you can doing it by turning the ints into strings, combining the strings and then using the combined string as intput to a new Long(String) but I really need a faster way using pure maths (maybe bit shift?) as this combination function will be used billions of times.
Thanks
Edited by: user8908143 on 29-Sep-2010 19:52

It's also a good way to get rid of boneheaded comments once one realizes how boneheaded they were. :-)A posteriori editing is another way :o)
[OT: Forum features and moderators] A posteriori edition ( self- or mod- )
Edited by: jduprez on Sep 30, 2010 6:21 PM
That being said (and mocked), the binary shift left solution seems correct (although I'd definitely go for a custom class and double-column key instead).

Similar Messages

  • How to import pictures into excel sheet without using report generation

    Dear Friends
    I want to know how to import the picture or picture file into excel sheet without using report generation..
    kindly come up with any suggestions or example code
    Regards
    Karthick
    Solved!
    Go to Solution.

    Thank you Rajesh 
    i am going through that vi
    Rajesh Nair wrote:
    Please go through below link
    http://zone.ni.com/devzone/cda/epd/p/id/3638
    Eventhough one subVI is missing i think it will be usefull for you.
    Regards
    Rajesh R.Nair
    Rajesh Nair wrote:
    Please go through below link

  • How do I combine two regents into one in Logic Pro Arrange?

    how do I combine two regents into one in Logic Pro Arrange?

    Thanks for your input kcstudio. I would still be left with 2 regions although one after the other, on one track.
    I am trying to save steps of the way I am combining the info of 2 seperate regions into one: bouncing the 2 tracks then re-importing that audio back into the project. It would save a lot of time if you could just drag one region on top of the other
                                W.W.

  • Combining two messages into one

    Hello,
    I have a mapping issue, I have a business process in which I have to combine two messages into one.
    To do so, I have defined a message mapping in which there are two source message types, and one target message type.
    When testing the message mapping in the IR, it works fine, but when I define and test an interface mapping with that same message mapping, I receive this error message:
    "Cannot produce target element /ns0:Messages/ns0Message1/MY_IDOC_TYPE/MY_SEGMENT. Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd."
    What am I doing wrong ?
    How am I supposed to combine two messages into one ?
    Thanks,
    Elad.

    Hi Elad,
    Just see if you have included both you source message interfaces and one target nessage interface correctly in while doing your interface mapping.....
    The most common mistake made when we do scenarios which include combination of two source message types into one target type are:
    - we forget to include both the source message interfaces.
    - or we interchange between one of the source message interface with the target.
    Just see if either of the 2 is aplicable in your case and just activate all components as and when you create them..
    Regards,
    abhy

  • Scrolling component into view programmatically without using javascript

    Hi,
    Is it possible to scroll an adf component into view programmatically without using javascript?
    I know of <af:scrollComponentIntoViewBehaviour> that can be added to a command component , but is there a way to do that programmatically in a bean?
    Problem with using javascript is its not guaranteed to work in different browsers.
    Regards,
    Rakesh.

    Hi John,
    Thanks for the reply.
    If i use the af:scrollComponentIntoViewBehavior, then i wont be able to achieve my desired functionality.
    In my use case, i want the id, of the component that needs to be scrolled into view, to be determined in the server listener of the button which is not happening.
    Code snippet in jspx page is as follows:
    <af:commandButton id="cb1" immediate="true">
    <af:clientListener method="clickButton" type="click"/>
    <af:serverListener type="customEvent"
    method="#{pageFlowScope.bean.doScroll }"/>
    <af:scrollComponentIntoViewBehavior id="#{pageFlowScope.bean.compId}/>
    </af:commandButton>
    And the java code for method doScroll is something like :
    public void doScroll (ClientEvent clientEvent)
    //logic to determine compId goes here
    compId = "id";
    So, the problem here is "compId" is set to some value when bean is loaded and the id in the af:scrollComponentIntoViewBehavior will be set to that value forever.
    I cant find any way of telling it to re-read the "compId" value, say after clicking the button. I can refresh the button in the server listener to update the compId .
    But the updated compId will come into picture from *next click*. This is because, after the button is clicked, "scroll" action happens first and then serverListener executes.
    Is there a way to change order of this execution like "execute server listener first and then do the scrolling thing" ?
    Regards,
    Rakesh.
    Edited by: 927925 on Jul 27, 2012 2:02 AM

  • How do you swap two variables A and B without using a 3rd variable?  No fun

    How do you swap two variables A and B without using a 3rd variable? No function or method allowed.
    For example:
    Given:
    A = 35
    B = 10
    Result
    A = 10
    B = 35

    How do you swap two variables A and B without using a
    3rd variable? No function or method allowed.
    For example:
    Given:
    A = 35
    B = 10
    Result
    A = 10
    B = 35
    A = A + B  (A = 35 + 10 = 45)
    B = A - B (B = 45 - 10 = 35)
    A = A - B (A = 45 - 35 = 10)

  • How do you swap two variables A and B without using a 3rd variable?

    How do you swap two variables A and B without using a 3rd variable? No function or method allowed.
    For example:
    Given:
    A = 35
    B = 10
    Result
    A = 10
    B = 35

    How do you swap two variables A and B without using a
    3rd variable? No function or method allowed.
    For example:
    Given:
    A = 35
    B = 10
    Result
    A = 10
    B = 35
    A = A + B  (A = 10 + 35 = 45)
    B = A - B (B = 45 - 35 = 10)
    A = A - B (A = 45 - 10 = 35)

  • How to combine video clips into one video clip using FCPX

    I typed this into the search engine but could not come up with anything. How do you combine Video clips into one Video clip using FCPX? Thanks in advance.
    Gar

    The simple answer is to put the clips together in a project in the desired order and export (oops, the new word is share [YUK!]) a master file.
    But maybe you should say a little more about the clips to determine whether the answer I've given is relevant to yor situation.

  • HT4759 How do I combine two accounts into one

    How can I combine two accounts into one account

    If you are talking about iCloud accounts, you can't.
    Or you could tell us what type of accounts these are?

  • URGENT:HOW TO COMBINE CLUSTER AND TRANSPARENT TABLE..WITHOUT USING FOR ALL

    how can we join bkpf and bseg without using FOR ALL ENTRIES.HOW DO I COMBINE THE 2 TABLES SO THAT I GET BETTER PERFORMANCE.
    START-OF-SELECTION.
    SELECT bukrs belnr gjahr budat FROM bkpf INTO TABLE i_bkpf
    WHERE bukrs = p_bukrs AND "COMPANY CODE
    gjahr = p_gjahr AND "FISCAL YEAR
    budat IN s_budat. "POSTING DATE IN DOC
    IF sy-subrc = 0.
    SELECT bukrs belnr gjahr hkont shkzg dmbtr FROM bseg INTO TABLE
    i_bseg FOR ALL ENTRIES IN i_bkpf
    WHERE bukrs = i_bkpf-bukrs AND "COMPANY CODE
    belnr = i_bkpf-belnr AND "A/CING DOC NO
    gjahr = i_bkpf-gjahr AND "FISCAL YEAR
    hkont = p_hkont. "General Ledger Account"
    IF sy-subrc = 0.
    SELECT bukrs belnr gjahr hkont shkzg dmbtr FROM bseg INTO TABLE
    i_bseg1 FOR ALL ENTRIES IN i_bseg
    WHERE bukrs = i_bseg-bukrs AND "COMPANY CODE
    belnr = i_bseg-belnr AND "A/CING DOC NO
    gjahr = i_bseg-gjahr. "FISCAL YEAR
    ENDIF.
    ENDIF.
    IF NOT i_bseg1[] IS INITIAL.
    LOOP AT i_bseg1.
    IF i_bseg1-hkont = p_hkont AND i_bseg1-shkzg = 'S'.
    v_sumgl = v_sumgl + i_bseg1-dmbtr.
    ELSEIF i_bseg1-hkont = p_hkont AND i_bseg1-shkzg = 'H'.
    v_sumgl = v_sumgl - i_bseg1-dmbtr.
    ELSEIF i_bseg1-hkont NE p_hkont .
    IF i_bseg1-shkzg = 'H'.
    i_bseg1-dmbtr = - i_bseg1-dmbtr.
    ENDIF.
    i_alv-hkont = i_bseg1-hkont.
    i_alv-dmbtr = i_bseg1-dmbtr.
    APPEND i_alv.
    v_sumoffset = v_sumoffset + i_bseg1-dmbtr.
    ENDIF.
    ENDLOOP.
    regards
    Essam.([email protected])

    Hi Friend,
      I see your code.. there is no other way than using for all entries for your situation.. how ever i saw ur code and a small recommandation in the change of code.
    SELECT bukrs belnr gjahr budat FROM bkpf INTO TABLE i_bkpf
    WHERE bukrs = p_bukrs AND "COMPANY CODE
    gjahr = p_gjahr AND "FISCAL YEAR
    budat IN s_budat. "POSTING DATE IN DOC
    IF sy-subrc = 0.
    if not p_hkont is initial.
    SELECT bukrs belnr gjahr hkont shkzg dmbtr FROM bseg INTO TABLE
    i_bseg1 FOR ALL ENTRIES IN i_bkpf
    WHERE bukrs = i_bseg-bukrs AND "COMPANY CODE
    belnr = i_bseg-belnr AND "A/CING DOC NO
    gjahr = i_bseg-gjahr. "FISCAL YEAR
    ENDIF.
    i_bseg[] = i_bseg[]1.
    delete i_bseg where hkont ne p_hkont.
    else.
      Your existing logic...
    endif.
    In this way you can avoide writing two selects on bseg..
    Thanks
    Mahesh

  • How do I combine two arrays into one?

    I am trying to combine two byte arrays into one. What function do I use that will put in the information in the same order just combined?

    battler. wrote:
    Julien,
    Used LV for years.  Never knew that (concatenate inputs).  Wouldn't believe the lengths ive used to get around it.  Thanks
    Same here! I actually learned about it taking a sample test for the CLAD.
    Richard

  • Combining two tables into one result

    Hi all, I am fairly inexperienced with Crystal but have gained good results from the reports I have created, I am fluent in SQL and Basic to an extent.  I am interigating a Pronto database and I want concatenate two tables into one report.
    Table One: Customer Orders
    Fields:  Customer No, Invoice Number, Invoice date, Invoice Amount, Cost Amount.
    Table Two: Archived Customer Orders
    Fields:  Customer No, Invoice Number, Invoice date, Invoice Amount, Cost Amount.
    I want to complete a report that will tell me the sales for a given period and the outstanding orders for each customer total for all fields in each table combined into one figure.
    Any help would be greatly appreciated.
    Thanks in advance

    Hi Grant,
    As you said you are goot at writing SQL, in Crystal write a SQL statement in Add Command to join both table using Union / Union all
    If you use Union then it will filter duplicate records and pull the data from database, If you use Union All then it will include all your duplicate records.  Please use Union / Union All as required.
    Once you get all data into the report create a parameter for date range and generate the summaries as required.
    Thanks,
    Sastry

  • Question - how do I combine two users into one?

    I have migrated a lot of data to a MacBook Pro using Migration Assistant, in the process two users have been created on the Mac. How do I combine the two users into one?

    You don't. Just log in with one, choose Go to Folder from the Finder's Go menu, provide /Users/ as the path. and drag the folder there; you'll need to provide an administrator password at some point.
    (108352)

  • Sapscript: How to combine two elements into a block when display ?

    /E  ITEM_CONDITIONS
    /:   PROTECT
    ZC &KOMVD-VTEXT&,,&KOMVD-KWERT&
    /:   ENDPROTECT
    /E  TOTAL_AMOUNT_ITEMS
    /:   PROTECT
    ZC &KOMK-SUPOS&
    /:   ENDPROTECT
    Hi, all. May i know how to combine the two elements into a same block when displaying?
    That's mean this two element content will not be split into two part between two pages when there is insufficient space in the front page.
    Thanks.
    Edited by: Jiansi Lim on Oct 8, 2008 12:24 AM

    You can evoke the PROTECT..ENDPROTECT in the print program before the call of the text elements.
          CALL FUNCTION 'CONTROL_FORM'
            EXPORTING
              command = 'PROTECT'.
          CALL FUNCTION 'CONTROL_FORM'
            EXPORTING
              command = 'ENDPROTECT'.

  • How to combine two albums into one

    I imported into iTunes two Shostakovich compositions so that I could burn a CD-R that contained these two works. The CD burning went fine, but iTunes insists on separating the two compositions into two albums in the display of all albums. I have made sure that the album titles and the artists displayed under the album icons are identical, but still the two will not meld into one. Will someone help me with this? I am using iTunes 9.2.1(4).

      On the "Get Information" windows (reached with right clicks) of the two separated albums, one album was marked as "no" on the "part of a compilation" option and the other was marked "yes". I changed the "no" to a "yes" and they merged. I'm not sure if I got this from the site you gave me or if I just stumbled on to it. Either way, I thank you for your kind responses.

Maybe you are looking for

  • Batch determination at sales order level

    Dear All, We are using my sap erp ecc 6.0.We are using the batch determination at sales order level.We had a problem whenever customer requested deliver date is beyond the RLT date then all the old batches which are already assigned and dispatched wi

  • How can i lookup a session bean from the client side

    how can i lookup a session bean from the client side...........i am using sun appserver.............. this is my code.................[B] private final static String JNDI_NAME="ejb/LmsBean"; private static String url="ldap://localhost:4848"; Hashtabl

  • Notifications during music playback

    Question - When playing music back through iPhone (iPhone 5s, iOS 7.0.4), I keep getting notifications - which makes the sound fade in and out. This didn't happen in iOS 6 and earlier - so I imagine its a notificaiton 'feature' - what's the best way

  • Assingned Objects for an Employee

    Hello All, My FDS has a requirements on Objects On Loan, Firstly it says to fetch the IHPA-PARNR , if it matches to PA0001-PERNR , then display equipment related to PARNR. Secondly it says ER=PARNR=PERNR, ** For evry PERNR entered verify the Partner

  • Number of Voicemail Rings Before It Picks Up

    Is it possible to change the number of rings on iPhone 4 before voicemail picks up. I would like it to pick up after 4 rings but right now it picks up after 6 rings.