Swap without using a temp var

can u help me..there is a way to swap two munbers without using anothere thirs variable..i donno
the way ou..pls help ... the numbers r given in the program itself???? thanx

Okay already. I've just tested out apppu's logic and it works fine.
A sample code and output is included below.
public class TestNum {
    public static void main(String[] args) {
        int a = 10;
        int b = 25;
        System.out.println("a="+a+" b="+b);
        System.out.println("a=a+b;b=a-b;a=a-b");
        System.out.println("=================");
        a = a+b;
        System.out.println("a="+a+" b="+b);
        b = a-b;
        System.out.println("a="+a+" b="+b);
        a = a-b;
        System.out.println("a="+a+" b="+b);
The Output:
a=10 b=25
a=a+b;b=a-b;a=a-b
=================
a=35 b=25
a=35 b=10
a=25 b=10
unformatted
public class TestNum {
public static void main(String[] args) {
int a = 10;
int b = 25;
System.out.println("a="+a+" b="+b);
System.out.println("a=a+b;b=a-b;a=a-b");
System.out.println("=================");
a = a+b;
System.out.println("a="+a+" b="+b);
b = a-b;
System.out.println("a="+a+" b="+b);
a = a-b;
System.out.println("a="+a+" b="+b);

Similar Messages

  • Upload a file into Oracle database without using a temp file in the server.

    Hello.
    I need to upload a file into a Oracle database, but I have not permission to write a temp file in the aplication server. Because of this, I can't use a MultipartRequest object.
    Does anybody know how to do this?
    Thanks everybody for your help.

    You can still use a MultiPart request.
    Use the Apache FileUpload package.
    Get the InputStream of the file being uploaded.
    Now you can either store the file in memory by writing to a java.io.ByteArrayOutputStream or you can save the file to Oracle by writing it to a java.sql.Blob object using the Blob.setBinaryStream method. This Blob object can then be persisted to Oracle.
    Unfortunately I don't have sample code readily available.

  • Signal to phone varies between 4G and 1X. Can that be improved without using antennae.

    Signal strength varies from 4G to 1X, is there an adjustment in the phone to correct or is it necessary to buy xtra antennae.

    Thank you for replying.
    Signal varies in 61822 and 33917 zip codes. The incline plane emblem next
    to battery icon never shows strength greater than just the tip of the
    indicator except when I go to Verizon corporate store where they have a
    booster. It happens in and out doors. I have not removed the sim card. This
    is a Motorola RAZR M with a number on back - CEO 168
         [image: Verizon Wireless
    Community]<http://community.verizonwireless.com>
    <http://www.verizonwireless.com/b2c/index.html>
    <http://www.verizonwireless.com/b2c/explore>
    <http://www.verizonwireless.com/b2c/store/controller?item=phoneFirst&action=viewShopIndex>
    <https://wbillpay.verizonwireless.com/vzw/nos/topline.jsp>
    <http://support.verizonwireless.com/clc/>    Re:
    Signal to phone varies between 4G and 1X. Can that be improved without
    using antennae.  created by Verizon Wireless Customer
    Support<https://community.verizonwireless.com/people/vzw_customer_support>in
    Android - View the full
    discussion<https://community.verizonwireless.com/message/1026021#1026021>

  • SWAP Equipment using IE4N, without serial number and material, it is possible?

    Hi PM Experts, I´ve been reading about the way to SWAP equipments from his functional location without using serial number and material, I think if it is not possible, but to be honest, I cannot find any logical answer for it, since equipment number is unique for a plant. Does anyone have found any work around for it?.
    I don’t want to use serial numbers and materials, because I think the process is really simple, since the client does not want to implement the refurbishment process. If there is a break down, here is what I do:
    Case 1:
    Dismantle damage equipment (Say PM01 Order Type)
    Install new equipment (same PM order)
    TECO the actual PM order
    ...Later
    Case 2:
    Create a new PM orden (say PM01 Order Type)
    Repair the break equipment
    TECO this new PM Order
    Here are the inconsistencies:
    What happen with the MTTR and MTBR reports?
    In case one, I´ll create the material as equipment, while I´m installing, starting date for his master data is the installation day, and the MTTR and MTBR will start to run. This is ok.
    What happened in case 2?, I need to stop the “clock” for the MTTR and MTBR of the dismantle equipment.
    This is the reason why, I would like to use IE4N, but since there are no serial number and material, I cannot.
    Can anyone please suggest a workaround for this scenario?.
    I´m thinking in use INAC (Object Deactivated) system status, can this status help me?, Does this status “stops” the clock for MTTR and MTBR report?. If I change the status to ACT, I´ll get the clock back running?.
    How about dismantle the equipment?, It will get the AVLB Available status, but the problem is, this equipment will be “floating” in the whole PM structure and I do not want it. I want to have it in a specific Functional Location but with this status, is this possible?. I woul like to use IE4N to SWAP UTs and later change the status to AVLB Available status, with and exits.
    I thinking in an Equipment Status and a “Z” MTTR and MTBR report, based on this status. But to be honest, I´d like a standard solution for it.

    For find my iPhone to work, the device has to be powered on and it has to be connected to a network (Cellular or WiFi).  Find My iPhone uses your AppleID as the account to search for.  Maybe the "guys" you were talking to were referring to a 3rd party application that essentially lo-jacks your device.  But even then, it would still require Power and a network. 
    I don't believe that there is currently a way to flag a specific serial number for location.
    Best of Luck.

  • 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 swap two string variables without using a 3rd variable?

    How to swap two string variables without using a 3rd variable?
    ex.
    A = "aa"
    B = "bb"
    Result required
    A = "bb"
    B = "aa"
    Thanks

    How to swap two string variables without using a 3rd
    variable?
    Something like this.
    Append A with B (so A equals "aabb")
    Set B equal to a substring of A starting with the first character and ending at A's length minus B's length. (So B equals "aa")
    Set A equal to a substring of A starting from B's length and ending at the end of A. (So A equals "bb")

  • How can I create a Glow without using a filter

    I am creating an application for iPhone4, and one of the problems I am having is the lack of filter support.
    I am trying to create a "stroke" around some bitmaps... an example would be a text field that is white on a bright background - I would put a black stroke around it to contract it... there are other needs as well, but this is an example.
    Before, I would just put a glow filter on the text field, tweak the settings and it looked good and did exactly what I wanted.
    But iPhone4 high resolution with gpu acceleration don't support filters - and I can't change those requirements... so any and all bitmap filters are out.
    Does anyone know of a way I can create a glow filter effect without using filters that would not be a major preformance hit for fps and memory?

    Have you tried using tweenMax and code in a glow effect.
    Something like this:
    import com.greensock.*;
    import com.greensock.plugins.*;
    TweenPlugin.activate([TintPlugin]);
    var glowEffect:TweenMax = new TweenMax(mc,0,{glowFilter:{color:0x330000,alpha:1,blurX:5,blurY:5,strength:2,quality:2,ov erwrite:5}});

  • Export table data in a flat file without using FL

    Hi,
    I am looking for options where I can export table data into a flat file without using FL(File Layout) i.e., by using App Engine only.
    Please share your experience if you did anything as this
    Thanks

    A simple way to export any record (table/view) to an csv fiel, is to create a rowset and loop through all record fields, like below example code
    Local Rowset &RS;
    Local Record &Rec;
    Local File &MYFILE;
    Local string &FileName, &strRecName, &Line, &Seperator, &Value;
    Local number &numRow, &numField;
    &FileName = "c:\temp\test.csv";
    &strRecName = "PSOPRDEFN";
    &Seperator = ";";
    &RS = CreateRowset(@("Record." | &strRecName));
    &RS.Fill();
    &MYFILE = GetFile(&FileName, "W", %FilePath_Absolute);
    If &MYFILE.IsOpen Then
       For &numRow = 1 To &RS.ActiveRowCount
          &Rec = &RS(&numRow).GetRecord(@("RECORD." | &strRecName));
          For &numField = 1 To &Rec.FieldCount
             &Value = String(&Rec.GetField(&numField).Value);
             If &numField = 1 Then
                &Line = &Value;
             Else
                &Line = &Line | &Seperator | &Value;
             End-If;
          End-For;
          &MYFILE.WriteLine(&Line);
       End-For;
    End-If;
    &MYFILE.Close(); You can of course create an application class for generic calling this piece of code.
    Hope it helps.
    Note:
    Do not come complaining to me on performance issues ;)

  • How to add byte[] array based Image to the SQL Server without using parameter

    how to add byte[] array based Image to the SQL Server without using parameter.I have a column in table with the type image in sql and i want to add image array to the sql image column like below:
    I want to add image (RESIM) to the procedur like shown above but sql accepts byte[] RESIMI like System.Drowing. I whant that  sql accepts byte [] array like sql  image type
    not using cmd.ParametersAdd() method
    here is Isle() method content

    SQL Server binary constants use a hexadecimal format:
    https://msdn.microsoft.com/en-us/library/ms179899.aspx
    You'll have to build that string from a byte array yourself:
    byte[] bytes = ...
    StringBuilder builder = new StringBuilder("0x", 2 + bytes.Length * 2);
    foreach (var b in bytes)
    builder.Append(b.ToString("X2"));
    string binhex = builder.ToString();
    That said, what you're trying to do - not using parameters - is the wrong thing to do. Not only it is insecure due to the risk of SQL injection but in the case of binary data is also inefficient since these hex strings are larger than the original byte[]
    data.

  • Length of a string without using any built-in functions

    code that returns the length of a string without using any built-in functions.
    thanks
    Sam

    A string is internally represented by a character array.  An array of characters will reside on the stack, not the heap.  Yes, we always learned that String is a reference type, but what goes on in your memory might still surprise you...
    A struct is internally represented by only it's private properties, sequentially on the stack.
    So basically, what I thought is happening by messing with the structlayout: is only tricking our programming a bit into thinking that the top X bytes on the stack represent a chararray, while actually we put them there as a string.
    Wrong. True. And wrong.
    A string is internally represented by, in that order, an array length, a string length, the chars. None of them resides on the stack.
    An array is internally represented by, in that order, an array length and the chars. None of them resides on the stack.
    When you use the FieldOffset attribute to handle the string as a char array, you don't get anything right:
    - the Length returned is the "array length" of the string, which is equal to the string length + 1.
    - the chars returned by the array indexer are shifted by 2 chars (the length of the "string length" field).
    You can use the FieldOffset to make that work, but it needs a little bit more work.
    unsafe static int Test()
    string myString = "This string may contain many string inside this string";
    string testString = "string";
    int countResult = 0;
    fixed (char* myChars = new StringToChar { str = myString }.chr, testChar = new StringToChar { str = testString }.chr)
    // The 2 first chars of the array are actually the string length.
    int myCharsLength = myChars[1] << 16 | myChars[0];
    int testCharLength = testChar[1] << 16 | testChar[0];
    for (int i = 0; i < myCharsLength - testCharLength + 1; i++)
    if (myChars[i + 2] == testChar[2])
    for (int j = 1; j < testCharLength; j++)
    var c = testChar[7];
    if (myChars[i + 2 + j] != testChar[j + 2])
    goto endOfCharAnalyses;
    countResult++;
    endOfCharAnalyses:
    continue;
    return countResult;

  • Memory Allocated using EXEC SQL VAR in ProC

    For a table that stores resumes, I have a ProC program which outputs LONG column values into a host variable. Here is the table definition:
         create table resume (resume_id number(5),
                   resume_size number(15),
                   resume_text LONG)
    The size of the resume_text can be vary from 0 bytes up to 90K bytes. We use the column "resume_size" to store the size of the resume_text in bytes. Since most of them are smaller than 8K, we don't want to allocate 90K memory for every resume SELECT call. Before we do the SELECT on the resume_text, a host variable pointer is used to allocate memory according to the size of the resume_text:     
         char *resume_buffer;
    len = get_resume_size(id); /* A SELECT statement to fetch the resume_size for this resume from the table */               
         resume_buffer = malloc(len); /* Allocate memory for the resume according to the resume_size. For example, len could be 6000 */
         EXEC SQL VAR resume_buffer IS LONG (100000);      /* without using a constant number will lead to a compiler error */
         EXEC SQL SELECT resume_text INTO :resume_buffer FROM resume WHERE resume_id = :id;
    Is 100000" the size actually allocated in memory (either OS level or Oracle data buffer cache) every time it runs or is it just the maximum possible size needed to satisfy the precompiler?
    Any help greatly appreciated.

    You have to use 'BEGIN procedure_name END' in the execute statement while calling PL/SQL Procedures
    EXEC SQL EXECUTE
    DECLARE
    BEGIN
    END;
    END-EXEC;

  • Data download to multiple sheets in Excel without using OLE

    Hi,
    Please let me know if it is possible to download data to multiple sheets in excel without using OLE method
    I am in SRM system and the OLE methods are not working
    Please share some sample code or reference links if any
    Thanks
    SekharJ
    Edited by: SekharJ on Sep 8, 2009 8:43 AM

    Here is my code
      LOOP AT it_final INTO wa_final.
        AT FIRST.
          l_ixml = cl_ixml=>create( ).
          l_document = l_ixml->create_document( ).
          l_element_flights  = l_document->create_simple_element(
                      name = 'PO_Details'
                      parent = l_document ).
        ENDAT.
        l_element_airline  = l_document->create_simple_element(
                    name = 'PO'
                    parent = l_element_flights  ).
        l_value = wa_final-object_id.
        l_rc = l_element_airline->set_attribute( name = 'Objectid' value =
                                                             l_value ).
        l_value = wa_final-description.
        l_rc = l_element_airline->set_attribute( name = 'Description' value =
                                                             l_value ).
        l_value = wa_final-number_int.
        l_rc = l_element_airline->set_attribute( name = 'Item' value =
                                                             l_value ).
        l_value = wa_final-description1.
        l_rc = l_element_airline->set_attribute( name = 'Description1' value =
                                                             l_value ).
        l_value = wa_final-quantity.
        l_rc = l_element_airline->set_attribute( name = 'Quantity' value =
                                                             l_value ).
        l_value = wa_final-capex.
        l_rc = l_element_airline->set_attribute( name = 'Capex' value =
                                                             l_value ).
        l_value = wa_final-ser_num.
        l_rc = l_element_airline->set_attribute( name = 'SerialNo' value =
                                                             l_value ).
        l_value = wa_final-plant.
        l_rc = l_element_airline->set_attribute( name = 'Plant' value =
                                                             l_value ).
        l_value = wa_final-loc.
        l_rc = l_element_airline->set_attribute( name = 'Location' value =
                                                             l_value ).
        l_value = wa_final-bundle.
        l_rc = l_element_airline->set_attribute( name = 'Bundle' value =
                                                             l_value ).
      ENDLOOP.
      l_streamfactory = l_ixml->create_stream_factory( ).
      l_ostream = l_streamfactory->create_ostream_itable( table =
    l_xml_table ).
      l_renderer = l_ixml->create_renderer( ostream  = l_ostream
                                            document = l_document ).
      l_rc = l_renderer->render( ).
      l_xml_size = l_ostream->get_num_written_raw( ).
        CALL METHOD cl_gui_frontend_services=>gui_download
          EXPORTING
            bin_filesize = l_xml_size
            filename     = 'c:\temp\flights.xlsx'
            filetype     = 'BIN'
          CHANGING
            data_tab     = l_xml_table
          EXCEPTIONS
            OTHERS       = 24.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    Edited by: SekharJ on Sep 8, 2009 12:04 PM
    Edited by: SekharJ on Sep 8, 2009 12:15 PM

  • Enlarging an image on mouseover without using Flash

    Enlarging an image on mouseover without using Flash
    I use DW MX 2004 with Windows 2000
    I want to create the following effect. I have two versions of
    an image,
    geyso_scr... (which is screen size) and geyso_sm (which is
    small). On
    mouse-over I want a larger window to open on top of my html
    page (but
    less than the full screen) and show the larger image file in
    whatever
    size I have created it.
    One mouse-off I want to restore the original image.
    I tried this with a straight image swap on the following
    page:
    http://www.tudo.co.uk/testing/hospiz_stiftung/shell/contents/vorstand/vorstand.html
    see row 2, image 1, Peter von Geyso.
    This works all right (on mouseover there is a shift of about
    1 px) but
    the screen sized image has been sized down to the original
    image (sm image).
    How can I conveniently get the large image hovering on top of
    the
    existing page?
    Can someone recommend a tutorial which describes how this is
    done?
    Or is there a utility which does it?
    On similar lines, a client wants to display a list of items
    as text in
    comparatively small font. On mouse-over he wants the
    list-item in
    question to become slightly larger (not only to change colour
    etc). Can
    that be done without converting the text into images.
    Is there any tutorial for that?
    (No point in arguing with the client that the text should be
    made large
    enough to read in the first place. I have tried that in
    vain.)
    Thanks for your help.
    Adrian

    netlace design wrote:
    > Hey Adrian,
    >
    > Maybe this will work for you. Take a look here at this
    demo
    >
    >
    http://www.cssplay.co.uk/menu/magnify
    Hi Netlace Design,
    This looks interesting, but where do I get the code for this.
    How is it
    done without javascript.
    Thanks,
    Adrian

  • Multiple Hit Button Without Using The Timeline

    Hello. I'm pretty much a beginner when it comes to flash. So,
    I assume there's been a post about this topic already. But, does
    anyone know how to script a code that lets you hit a button
    multiple times to execute an action without using the time line.
    For example. on
    http://www.group94.com/ website
    under menu / projects they use arrows to move the text on the y
    axis. Every time you click down on the text, it shifts upwards. I
    assume this a multiple hit action since the text shifts to? Can
    anyone help. Thanks.
    George

    Well, every action assigned to a button is executed multiple
    times when the button is hit repeatedly. I assume you mean kind of
    different actions? This could be done with a counter variable and a
    switch statement, like this:
    var count:Number = 0;
    button.onRelease = function(){
    count++;
    switch(count){
    case 1:
    // actions for 1st click
    break;
    case 2:
    break;
    case 5:
    count = 0; // reset counter
    break;
    However, in the website you linked, I suppose they don't do
    it this way, but with a more dynamic approach: Load the data (links
    and linktext) from a xml or text file, then build an array out of
    the contents and display the first entries. When the button is
    clicked, the first entry goes off, the next entry comes in. When
    the end of the array is reached, go back to entry 1 (not sure they
    do that, I didn't try it so far). So you would need a function,
    like displayNext(), that executes on every click and checks for
    itself which is the next entry to display and goes through the
    array this way.
    That's just a guess how they did it, or rather, how I would
    do it. ;)
    hth,
    blemmo

Maybe you are looking for

  • Illustrator script to create symbols from images in folder

    Time to give back to the community... Here is a script I recently devised to bulk create symbols from images in a folder. Tested with Illustrator CC 2014. // Import Folder's Files as Symbols - Illustrator CC script // Description: Creates symbols fro

  • HT5278 i get an error message when i try to update and i don't know what to do

    I am trying to update my iphone with the ios 5.1.1 but every time i download(2hrs), it gives me an error messg and will not update! 

  • Mailbox move request missing

    Dear Forum Members, We have two Exchange 2013 servers, with two databases in a DAG configuration. Now one of them appears to be almost full, so we decided to move one 4Gb mailbox to the other database. This should be kind of routine job, but after I

  • ABAP WebDynpro - ArchiveLink - PDF Error: "File does not start with..."

    Hey community, I have a WebDynpro application in which I want to show a Archive document. I'm using FM 'ARCHIV_GET_TABLE' and then FM 'SCMS_BINARY_TO_XSTRING'. But I only get the error message: (see also attached) File does not open with "%PDF-". Loc

  • Grouping not quite there . . .

    Greetings, First off, I have searched and reviewed previous posts for an answer but have not found anything that seemed to address the issue I am experiencing. DB: MySQL CF: 8 Below is query/code which displays only one FirefighterName. There could b