How do I find the min and max of 4 ints?

I can't get this to work
int max = Math.max(enter1, Math.max(enter2, Math.max(enter3, enter4)));
int min = Math.min(enter1, Math.min(enter2, Math.min(enter3, enter4)));                                                                                                                                                                                                                                                                                                                                                                   

your code is ok, if you wanna try:
public class JProof {
public static void main(String args[]){
int enter1=10;
int enter2=15;
int enter3=8;
int enter4=9;
int max = Math.max(enter1, Math.max(enter2, Math.max(enter3, enter4)));
int min = Math.min(enter1, Math.min(enter2,Math.min(enter3,enter4)));
System.out.println("the higher is: "+max);
System.out.println("the lowest is: "+min);
}

Similar Messages

  • Read the min and max occurrence from XSD

    Hi,
    I have a scenario where I have an XML, but not its XSD so my question is of two fold
    1. Is it possible to create an XSD from that XML, if possible how?
    2. Assume I get the XSD how do I read the min and max occurrence from that XSD?
    PS: I am coding in java and pretty new to it, so it would be really helpful if I get the code snippets for the same :)
    Edited by: Harsha.Hegde on Sep 2, 2008 5:49 AM

    Harsha.Hegde wrote:
    Hi,
    I have a scenario where I have an XML, but not its XSD so my question is of two fold
    1. Is it possible to create an XSD from that XML, yes
    if possible how?by using a text editor, tools, etc.
    2. Assume I get the XSD how do I read the min and max occurrence from that XSD?sigh
    PS: I am coding in java and pretty new to itthen you should take some time to learn the basics, then work your way into XML after you have a grasp on things conceptually.
    so it would be really helpful if I get the code snippets for the same :)sorry, no handouts here
    do your own work
    come back when you're written some Java and have a technical question

  • To find out the min and max memory been used by each parameter under SGA_MA

    Hi,
    Can any please tell me how to find out the min and max memory been used by each parameter under SGA_MAX and SGA_TARGET ? below is the db CRMS65T. If any such script is there please provide me
    SQL> select name from v$database;
    NAME
    CRMS65T
    SQL> show parameter sga
    NAME                                 TYPE        VALUE
    lock_sga                             boolean     FALSE
    pre_page_sga                         boolean     FALSE
    sga_max_size                         big integer 1000M
    sga_target                           big integer 1000MThanks in advance

    Can any please tell me how to find out the min and max memory been used by each parameter under SGA_MAX and SGA_TARGET ? below is the db CRMS65T. If any such script is there please provide meI guess your question is, each memory components of SGA? if so
    SQL> select * from v$sgainfo;
    NAME                                  BYTES RES
    Fixed SGA Size                      2088504 No
    Redo Buffers                       18882560 No
    Buffer Cache Size                 616562688 Yes
    Shared Pool Size                  301989888 Yes
    Large Pool Size                     4194304 Yes
    Java Pool Size                      4194304 Yes
    Streams Pool Size                         0 Yes
    Granule Size                        4194304 No
    Maximum SGA Size                  947912704 No
    Startup overhead in Shared Pool   125829120 No
    Free SGA Memory Available                 0Also check
    SQL> select COMPONENT,CURRENT_SIZE,MIN_SIZE,MAX_SIZE,USER_SPECIFIED_SIZE from v$sga_dynamic_components;
    shared pool                                                         301989888  301989888          0           209715200
    large pool                                                            4194304    4194304          0             4194304
    java pool                                                             4194304    4194304          0             4194304
    streams pool                                                                0          0          0                   0
    DEFAULT buffer cache                                                616562688  616562688          0           603979776
    KEEP buffer cache                                                           0          0          0                   0
    RECYCLE buffer cache                                                        0          0          0                   0
    DEFAULT 2K buffer cache                                                     0          0          0                   0
    DEFAULT 4K buffer cache                                                     0          0          0                   0
    DEFAULT 8K buffer cache                                                     0          0          0                   0
    DEFAULT 16K buffer cache                                                    0          0          0                   0
    DEFAULT 32K buffer cache                                                    0          0          0                   0
    ASM Buffer Cache                                                            0          0          0           603979776
    13 rows selected.
    SQL>Edited by: CKPT on Sep 19, 2011 8:55 AM

  • How can i find the size and contents of playlist created by genius?

    How can i find the size and contents of i-tunes playlist created by genius?

    Have a look at this article written by the CEO of our company (MoviMED):
    http://www.qualitymag.com/articles/91010--d-imaging-enters-the-machine-vision-world?v=preview
    What is the object you are going to be making with the CNC?  Is it a cube? Is it an intricate statue?
    Are you making an object with a CNC, or just mounting a camera to a CNC to image the object?
    www.movimed.com - Custom Imaging Solutions

  • How do I find the date and time stamp on pictures?

    How do I find the date and time stamp for my pictures?

    The Photos app will not do this but other apps will. iPhoto has an icon that when tapped with the photo open will show the EXIF information you are looking for. iPhoto is not free but you can purchase it in the App Store.
    There may be other photo apps that provide this information as well.
    PhotoForge2 will show the EXIF data as well as the GPS data if it is available.

  • HT5527 I HAVE OLD PHONES BACKED UP.  how do i find the data and recover or delete dups and junk

    I HAVE OLD iPHONES BACKED UP.  how do i find the data and recover or delete dups and junk

    You can't see the data inside the backup, and you can't restore just part of the data if that's what you're asking. To see the data you have to restore the entire backup.

  • When emailing a photo from the updated iPhoto, how do I find the CC and BCC button, and how do I send to a group from my address book?

    when emailing a photo from the updated iPhoto, how do I find the CC and BCC button, and how do I send to a group from my address book?

    The email function from iPhoto is pretty basic. The only Bcc available is to yourself (in iPhoto > Preferences > Advanced), cc: does not appear to be available at all, and it does not appear you can email to a group.
    You can change this by going to iPhoto > Preferences > General and next to where it says Email photos using: select Mail. If you do this you have all the options available in Mail including Cc: and Bcc: and the ability to drag a group from Address Book into the mail addresses.
    Best of luck.

  • HT1725 I have paid for a movie rental, when trying to download but wifi got interrupted , therefore I can't see the movie in the download section , it's disappear and I have paid for it , how can I find the movie and continue the download ?

    I have paid for a movie rental, when trying to download but wifi got interrupted , therefore I can't see the movie in the download section , it's disappear and I have paid for it , how can I find the movie and continue the download ?

    In the "Store" menu, click "Check for Available Downloads"

  • How do I find the apps and tracks associated with my ex-husband's account to delete them OTHER than 1 by 1-running Windows 8?

    I recently migrated my extensive library from a Mac authorized with both my and my ex-husband's id's to a Windows 8 machine only authorized with my id. I am finding that a good portion of the apps and tracks are still only authorized by his. How do I find these so I can delete them from my library? Finding them 1 by 1 has been VERY tedious. I have seen a script for the Mac to do this, but no solutions for Windows.

    It doesn't sound like the Exchange environment is configured in a manner to support these types of clients very well.  Have your Exchange team look at the following
    http://blogs.technet.com/b/exchange/archive/2012/11/26/supporting-windows-8-mail-in-your-organization.aspx
    http://blogs.technet.com/b/exchange/archive/2013/10/18/supporting-windows-mail-8-1-in-your-organization.aspx
    From the latter article: "Communications applications can connect to a corporate Exchange service
    configured to require certificate-based authentication. User authentication certificates can be provisioned to Windows 8.1 devices by administrators or end-users can browse to certificate and install to user certificate storage."
    You might want to:
    Ask your Exchange team the public URLs (ExternalURL) for Exchange OWA & ActiveSync
    Open the OWA URL in your Internet Explorer from your Surface
    If you get a Certificate warning, open the certificate and select Install (NOTE: You may have to install the entire certificate chain).  Your desktop support team should be able to support this because it is the SAME process for standard Windows 8x
    desktops.
    Confirm that you can open OWA on your surface with no more certificate or security warnings.  NOTE: The Exchange team will have to configured OWA properly.
    Once confirmed, repeat the same steps for the activesync URL that they provided.
    When done, try using the OWA OR ActiveSync URL value in your settings of your Mail client.
    Good Luck

  • ITunes showing wrong artist artwork. how do i find the image and delete it?

    iTunes is showing the wrong artwork for an artist.  What is strange and frustrating is that the image is not the artwork for any of the artist's albums.  iTunes seems to be pulling it from nowhere.  I can't figure out where iTunes is pulling the image from.  It's a ted talk image. 
    How do i go about finding where the image is coming from to delete it?  Sting gave a ted talk, which i had downloaded, so iTunes may be getting it as a result of that.  i deleted the ted talk, deleted all the albums, and then uploaded them again but the image keeps popping up.  also tried deleting the artwork cache with no luck.  any suggestions besides deleting all of the Sting albums????? 

    Try giving one of your Sting albums a 5 star rating. Close iTunes and reopen. The artwork used for the artist should change.
    tt2

  • How can I find the name and path of the host html page

    Hi all,
    I want to make a banner using flash. This banner will be
    included in several pages in several domains.
    So, I want to count the clicks and store statistical data,
    calling an asp, and I want to get the host HTML page name which
    includes my banner.
    How can I do this?
    Thanks in advance

    or you can use the localConnection class inside of flash....
    it will return the domain name for you.
    var lc:LocalConnection = new LocalConnection();
    trace(lc.domain());

  • How do I find the slope and intercept of two-points in Labview

    This should be quite easy to do, But how do I have a user enter two (x,y) points and have labview give them the slope and intercept?
    Thanks

    How about just two sets of X Y value pairs?
    Darn, I'm too slow.
    Message Edited by Bill@NGC on 02-09-2008 02:42 PM
    “A child of five could understand this. Send someone to fetch a child of five.”
    ― Groucho Marx
    Attachments:
    slope.png ‏23 KB

  • TS2755 I am trying to find a message from 2012 and when I load previous messages it only goes back so far then the program quits and sends me to the home ( main) screen. How can I find the message and get around this?

    I am trying to access a message from early 2012. When I load previous messages It will only go back to oct 2012 and then the program stops and kicks my to the home page. Anyone know how I can get to the message? Thanks.

    Try Spotlight Search
    1. From any Home screen page of iPad, drag your finger down anywhere on the center of Home screen.
    2. Spotlight search will now appear and you can search for apps, texts, or any other content you'd like just as you did on previous versions of iOS.

  • HT3770 I have recently bought a external hard drive and I was told to down load a Fat 32 in order to work with my MAC/ Is this right and how do I find the download and how to install to make my new external drive compatible with my MAC?

    What is a Fat 32 which I am suppose to download inorder to work on a MAC for external drive to be compatable ?

    Bad advice. You do not need or want FAT.
    You want GUID and Mac HFS Standard Journaling.
    You don't download when you write files, or when you format or erase a drive.
    General purpose Mac troubleshooting guide: Isolating issues in Mac OS X
    Creating a temporary user to isolate user-specific problems: Isolating an issue by using another user account
    Identifying resource hogs and other tips: Using Activity Monitor to read System Memory and determine how much RAM is being used
    Starting the computer in "safe mode": Mac OS X: What is Safe Boot, Safe Mode?
    To identify potential hardware problems: Apple Hardware Test
    General Mac maintenance: Tips to keep your Mac in top form

  • Find min and max from a bunch of numbers

    hi,
    i have a bunch of numbers, and i need to find the min and max.
    so i have a arraylist which contains objects....whats the best way to find the min number and max number of all these objects?
    thanks

    You're close, but you can do them all at the same time without temp variables..
    double maximumX = 0;
    double minimumX = 0;
    double maximumY = 0;
    double minimumY = 0;
    for (int i = 0; i < myobjects.size(); i++) {
         mything d2d = (mything) myobjects.get(i);
         maximumX = Math.max(d2d.getBounds().getMaxX(), maximumX);
         minimumX= Math.min(d2d.getBounds().getMinX(), minimumX);
         maximumY = Math.max(d2d.getBounds().getMaxY(), maximumY);
         minimumY = Math.min(d2d.getBounds().getMinY(), minimumY);
    }Since you are dealing with rectangles, you could add them all to an Area and get the bounds of the Area, but that's probably slower.

Maybe you are looking for

  • Can I use Time Machine to backup ONLY an external drive?

    I am having problems with the internal HD on my iMac and Disk Utility is telling me I need to reformat the drive and restore from backup. Only problem is that my 3TB Lacie Thunderbolt drive I was using for Time Machine recently failed (think it may h

  • PLEASE HELP!! Weird screen glitch in After Effects CS5.5?!? (Windows 7)

         I was editing some videos in the trial of After Effects CS5.5, and I went to render something in full screen (I've been using it for two weeks now, and i've rendered in full screen before) and suddenly a bunch of error messages started popping u

  • Can i copy text from illustrator to indesign and retain attributes

    Hello, I received an illustrator cs3 file that I need to convert to InDesign cs3. Is there a way to copy the type that is set in illustrator to indesign, while retaining the attributes. I need to be able to make changes on the type in indesign, so co

  • New macbook pro 2011 weak and dropping wireless connection

    Just looked throught this part of the forum and found out there are a lot of people out there which seem to have the same problem as me. I purchased a new modell 2011 MBP on the very first day from our apple store. At home, sitting directly beside th

  • Attach Forms With Comm Port in Oracle Forms

    I am trying to make connection of Oracle forms Builder with my device using comm port but i dnt know the complete procedure to attach the comm with oracle forms also i have no idea to convert asquii data to normal form.Please any one help me to attac