When to use primitive numbers range

Hi
I am a noob and was just wondering in what programming situations I would use javas various number primitives e.g. int, double, byte, long, short, float.
The only situations I have used numbers is:
int - to represent whole numbers
double - to represent decimals, real life example would be prices
Can anyone give me real life examples of where I might use the other number primitives?
Many thanks

Can anyone give me real life examples of where I
might use the other number primitives?Actually to use double (or floating points in general) for currency isn't such a good idea because of rounding problems. An integral type like int or long is a much better alternative for handling "prices".
Floats are often used in graphics applications because it's the "natural" floating point type in OpenGL.
Say you need to store a huge number of integers in an array. You can cut the memory requirements in half by using shorts instead of ints.
So I'd say all primitives have their uses but int and double are probably the most frequently used. If you standardize on them you also avoid implicit conversions in expressions which makes life a lot easier.

Similar Messages

  • How to use different  numbers ranges in LSMW for a material in 8plants

    Hi all,
    I have to upload data using MM01 in LSMW by using external numbers.
    the MATNR for materials are like this 17240,22818,82618,487218,7218,26418
    how can i take these numbers in LSMW.i have 61 material numbers to be extended to 8plants.can i upload these material numbers at a time in LSMW
    the above material number should be extended to 8plants.but the field values for some fields are varying.the material number should be same for 8plants
    For this issue, which method i should follow in LSMW.

    Just do one thing,
    while recording enter the material numer field by yourself(Not blank).This material is the material which you mention out of 61,
    and upload the same in your upload file, and just change plant.i mean 8 records are there for each material( all 61)
    reward if useful.
    Amit Singla

  • When i use the numbers assigned to me a local pers...

    I just got skype to go number yesterday,and the numbers I got when I dial them a local person answers, what can I do.ps the local country is Mexico.

    Sounds like it is malware. For suggestions with lists of security programs available and articles on the subject:
    * See thread [https://support.mozilla.com/en-US/questions/773501 Search bar causes browser to be hijacked]

  • Numbers does not open with the main user after installing mountain lion. It works flawlessly when I use the second account on my mac. What got corrupted in the admin-account, something in the user-library? How can I fix it? I´m kinda desperate...

    Numbers does not open with the main user after installing mountain lion. It works flawlessly when I use the second account on my mac. What got corrupted in the admin-account, something in the user-library? How can I fix it? I´m kinda desperate... (the same happens with the other iWork-Apps!)
    Looking forward to hearing from somebody with a littlemore expertise than me, Chris

    you can remove preferences files by navigating to the Preferences folder for your user as follows:
    0) Quit ALL iWork apps (Keynote, Pages and Numbers)
    1) from the Finder select the menu item "Go > Go To Folder…".  This will bring up a dialog:
    2) enter the path "~/Library/Preferences" (no double quotes)
    3) find the files:
    com.apple.iWork.Keynote.plist
    com.apple.iWork.Numbers.plist
    com.apple.iWork.Pages.plist
    and move these to the trash.  I would NOT empty until later.
    4) restart Numbers

  • When using a numbers spreadsheet, how do I select a specific area for printing?

    When using a numbers spreadsheet, how do I select a specific area for printing?

    Also this would be a question for the Numbers app fourm.  Not the iMac hardware fourm.

  • I am currently in Cameroon, Africa and after arriving here, I added Global services to my plan in hopes to be able to use my phone to call local numbers.  When I dial local numbers in Cameroon, with or without the country code, the call fails.  I suspect

    I am currently in Cameroon, Africa and after arriving here, I added Global services to my plan in hopes to be able to use my phone to call local numbers.  When I dial local numbers in Cameroon, with or without the country code, the call fails.  I suspect it may be that the phone is 3G and this area only supports 2G.  Help!

    cctga,
    We appreciate you taking the time to reach out to us. I am sorry to hear that you are having trouble while traveling. We definitely want to make sure you have all available options. Normally when traveling internationally we reccommend setting up international services prior to leaving. When you added the services did you do so online or with a rep? It would be best to contact our global department in order to troubleshoot any and all issues with services while international http://vz.to/17KseUf.
    Thank you,
    TonyG_VZW
    Follow us on Twitter @VZWSupport

  • Double character input error when entering data in numbers using Bluetooth keyboard.

    Using a bluetooth keyboard (Logitech) sometimes causes a double character input when entering data in numbers.
    For example if wish to enter the number "22" or the word "in" they become "2222" and "iinn". Pressing enter of tab also causes a double jump
    This problem is not always solved by turning keyboard off and on or by closing down and restarting numbers.
    This problem does not occur in any other app.
    I have used 2 different Logitech keyboards (ultra-slim and the recently new folio keyboard) and both caused the same problem.
    The error is sporadic but frequent and has lead to me often having to switch back to touch input.
    Very frustrating considering these excellent keyboards are ideal for using in numbers when working correctly!
    ANy advice would be much appreciated

    Zombie,
    Not much help I'm afraid, but I just saw your post & wanted to let you know that I have the same problem, but for me it manifests itself in many apps, and it happens with the Apple bluetooth keyboard
    . The only thing I've noticed is that it only seems to happen when I first start typing after not using the keyboard for a while (I'm not sure how long a while is, but maybe 30 seconds or so). Then I'll type & the first few letters will be fine, and then one letter double-types, and then it's fine again until I stop using it for whatever the threshold amount of time is. I'm guessing that it has something to do with the iPad's battery management & that it's shutting off the connection to the keyboard or something & once it picks it back up, then it double-types that letter.
    At least in Pages, it isn't as big of a deal because I know it's coming, I can correct it & then type for a long time. In Numbers, my keyboard use is much less consistent, so I need to be more cognisant of it.

  • Which BW variable is used for date(range) when creating a portal service

    Hi,
    Can any one please let me know which BW variable is to be used for date(range) when creating a portal service for searching based on dates.
    Thanks
    Abhai

    Hi Arun,
    its just a portal service which would be called when  searching a document created on a particular date or betwwen a range of date.so what i require is which BW variable to be used when handling range.As for variable technical name we use VAR_NAME_I  and for single value variable we VAR_VALUE_EXT_I
    in the similar manner i want BW variable to be used for range of values.
    Thanks
    Abhai

  • Hi, I have an iPhone 4 which rings people when it is locked, whether or not in my pocket.  I always lock it when not using it.  Can anyone help? It is calling random numbers, not the last person or anyone even recently called on my recents list. Thanks

    Hi, I have an iPhone 4 which rings people when it is locked, whether or not in my pocket.  I always lock it when not using it.  Can anyone help? It is calling random numbers, not the last person or anyone even recently called on my recents list. Thanks

    Pay no attention to iinami, the amount of replies to people saying their handsets must have been jailbroken everytime iTunes throws out an error is tremendous. (Clearly you don't need to have any real knowledge to get to level 3 on these forums, let's hope apple's geniuses know a lot more than some of their customers.)
    http://support.apple.com/kb/TS3694
    Solution below.
    Error 9
    This error occurs when the device unexpectedly loses its USB connection with iTunes. This can occur if the device is manually disconnected during the restore process. This issue can be resolved by performing USB troubleshooting, using a different USB dock-connector cable, trying another USB port, restoring on another computer, or by eliminating conflicts from third-party security software.

  • When I'm out of range for Wi-Fi on iPad, can I use the Internet connection from my iPhone 5?

    I only get Internet on my iPad when I have my wireless router. When I'm out if range can I piggyback with my iPhone5? If so, how.

    Yes, you can use the hot spot feature of the iPhone 5 to create a WiF Access Point.
    See here in Chapter 33 Settings http://manuals.info.apple.com/en_US/iphone_user_guide.pdf

  • Division wise Separate numbering range required for invoices

    Hi Gurus,
    The requirement is Division wise Separate numbering range required for invoices. For e.g  like 11 Steel Fabrication, 12 Aluminum Fab, 13 Carpentry & Join, 14 GRP/GRC, 15 Stone & Marble
    Already a table ZSD_NUM_RANGE with fields like Client, Plant, Number range in the case of internal number assignment
    Presently number range is based on plants.
    I understand that Division field SPART is to be included in this table by using the exit given below:
    User Exit For Billing
    USEREXIT_NUMBER_RANGE (Module pool SAPLV60A, program RV60AFZZ)
    The internal number range used in the standard system is specified in the billing type table and can be changed in this user exit. This user exit is only called when the billing documents is created.
    May I know how far this is feasible to shift plant wise no. range to division wise no. range.?
    Also if we do division wise number range, How about shifting to new invoice numbers in the middle of the FISCAL year?
    Kindly revert back to me at your earliest.
    Regards,
    Anbu

    Dear Anbu
    Ideally speaking, invoice number range should be per plant and the user exit what you had indicated holds good.  May be you can try with the same user exit.
    thanks
    G. Lakshmipathi

  • Thermocoup​le reading has offset when I choose a large range on virtual channel?

    I am using SCXI 1102 with 1303 terminal block. I create a virtual channel for a type J thermocouple using CJC built-in. I set the range of the measurement to 0 to 500C. At ambient temperature (22C) I read 10C. If I change the range to 0 to 100C the reading is correct. How can I fix this problem?

    Well, you already tried the obvious. The less obvious might include NI-DAQ driver problems. It has happened before.
    On a SCXI-1126 frequency module, back in the 1998-2000 time frame, the underlying code within NIDAQ had a problem where when you picked a channel scaling that was EXACTLY within the boards ranges, such as 1k, 2k, 4k, 8k, etc., the board read back frequencies correctly. However, when you used a virtual channel to set up scaling to something like, say, 0-2200hz, the algorithm to span that wrange worked incorrectly. It evidenced itself as a drop off followed by a peak rather than a gradual ramp up in readings as the frequency increased. I eventually created a program that plotted the problem and showed it to our local
    rep, who got it fixed back at NI.
    The point is, the problem didn't show up in NI's production testing because they always used exact ranges in tests, while virtual channels allowed more flexibility. Somehow you need to be able to get NI to duplicate the behavior.
    - You could try using other ranges in your scaling that still have your necessary ranges as a subset.
    - You could try using DAQ MX if you are using traditional DAQ, or vice versa.
    - You could send someone at NI your NICONFIG.DAQ file and have them try it there, with whatever version of LV and DAQ you are using.
    Another thing that could have happened is that you may have a group of boards with a bad lot of chips. Check to see if all the boards you are swapping during troubleshooting have the same lot numbers on the chips. If possible, try to find at least one board that is much older or much newer when you are swapping. We resolved a 4 year problem when we finally realized 56 solid state relays on 14 different S
    CXI-1321 front end modules all had the same exact thermal problems, and were all from the same manufacturer lot. Swapping with a different module 2 years older confirmed what we had been missing for years!
    Tim Jones

  • IN: int a, int b; OUT:Vector filled with numbers ranging from a to b

    Hello,
    is there any method to fill in a vector with numbers ranging from a value "a" to value "b"? Of course it can be done using a for-loop, but I was wondering if there is not a simpler way to do it. Thanks for your advices.
    Example:
    INTPUT:
    int a = 4;
    int b = 9;
    Vector seq = new Vector();
    seq.setSize(b-a);
    OUTPUT:
    pseudocode: seq = {4,5,6,7,8,9};

    Darryl.Burke wrote:
    Hmmm.. what happens when the other methods of AbstractList are invoked on an instance of IntRangeList? Wouldn't you need to override pretty nearly all the methods for consistency? And some methods, like remove and set, would have to throw a UnsupportedOperationException.If you read the API documentation of AbstractList then you could find out that you could implement a fully functional, fully compliant (unmodifiable) List implementation by just providing size() and get(int). All other accessor methods (including subList() and iterator()) will be using those two methods and fully work.
    Writing a loop to populate a simple ArrayList would be trivial by comparison :-)Indeed, but if it's needed often and with big ranges, then there's no loss in using this implementation.
    db
    edit In fact, extending AbstractList appears irrelevant as none of the features of AbstractList are used. The IntRangeList, in fact, is-NOT-a AbstractList but just fakes it in respect of the 2 methods overridden in your code sample.What? All the features are used. Read the API doc. If I handn't extended AbstractList, but instead implemented List directly, then I'd have to implement all the methods myself (including an Iterator, which, while trivial in this case, can be non-fun to implement correctly).

  • Having a problem with dates when I send my numbers doc to excel. dates are all out and that they have to cut and paste individual entries onto their spreadsheet. Any idea how I can prevent this

    having a problem with dates when I send my numbers doc to excel. dates are all out and that they have to cut and paste individual entries onto their spreadsheet. Any idea how I can prevent this.
    I'm using Lion on an MBP and Numbers is the latest version

    May you give more details about what is wrong with your dates ?
    M…oSoft products aren't allowed on my machines but I use LibreOffice which is a clone of Office.
    When I export from Numbers to Excel and open the result with LibreOffice, the dates are correctly treated.
    To be precise, dates after 01/01/1904 are correctly treated. dates before 01/01/1904 are exported as strings but, as it's flagged during the export process, it's not surprising.
    Yvan KOENIG (VALLAURIS, France) mardi 3 janvier 2012
    iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My iDisk is : http://public.me.com/koenigyvan
    Please : Search for questions similar to your own before submitting them to the community
    For iWork's applications dedicated to iOS, go to :
    https://discussions.apple.com/community/app_store/iwork_for_ios

  • How do I use page numbering and a text block in a footer in Word with the Report Generation Toolkit?

    I am creating a Word document with the Report Generation Toolkit, and LabVIEW 8.2.1. In the report I am using a template that has page numbering enabled in the center. When I try to add a text block to the left side footer, it eliminates the page numbering and adds my text on the left side. I found "Set Report Footer Text" and "Word Set Page Numbering" vi's that may be the clue to this. When I use these two vi's I either get Page 1 of 456789-001 on the left side, or if I reverse the order I get only 456789-001(text) in the left side with nothing in the center. What I would like to achieve is 456789-001(text) on the left footer, and Page 1 of 2 in the center. Is this possible and if it is, then how can I do it?

    Hi SciManStev,
    I have attached a vi where you can see how they can be made to work together. You have to design it such that one follows the other. If you don't design it that way, it results in a race condition and only one of them get executed.
    Good Luck!
    Warm regards,
    Karunya R
    National Instruments
    Applications Engineer
    Attachments:
    SciMan1.vi ‏14 KB

Maybe you are looking for

  • Sales requirement report using ALV

    Sales Register Requirement Specifications:---- 1.Fields on selection screen (input screen) : Plant Code From to , Distributional Channel  from to , Division from to , Customer Code from to , Period From to , Material Code (can be used using *) . 2.Fi

  • How do you get straight answers about Apple products?

    I'm trying to gather information on buying Apple products and my posts keep getting deleted. So, I'm not even going to ask why my posts were deleted because I'm sure you have some reason for everything. What I am going to ask is where I can go to get

  • Can I uninstall one of my activated Photoshop CS6 Extended & put it on a new computer?

    Hi all, I was hoping to purchase a new MacBook Pro laptop very soon and I want to put my Photoshop CS6 Extended on it. I have put my Photoshop on 2 computers, both being Windows Vistas, and was wondering if I could deactivate and uninstall only ONE o

  • Entire Creative Suite won't launch:  Bridge CS4 won't load

    Dear Readers: I posted this in Bridge forum because it seems to be the key behind Adobe CS4 applications being unable to launch in my Windows XP Pro SP2.  When I restart the computer and the Bridge Icon appears in the startup taskbar on the lower rig

  • Issue with layout / repeat region

    Can someone have a look at this please? Basically two versions of a details page based on a recordset using two tables and an interlinking lookup table. The idea is to display a person's details at the top of the page on the left (from the 'Candidate