Arrays


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Arrays

  1. #1
    Join Date
    Dec 2005
    Posts
    27

    Arrays

    Does any know how i can calculate the minimum value of an array of Integers. Thank you for your help and have a happy new year

  2. #2
    Join Date
    Dec 2005
    Location
    New Jersey
    Posts
    290
    Loop through the array and set the lowest to a variable.

    Code:
    Integer[] array = new Integer[num];
    
    // set array values here
    
    int smallest;
    
    for (int i = 1; i < array.length; i++) {
        smallest = Math.min((int) array[i - 1], (int) array[i]);
    }
    
    System.out.println(smallest);

Similar Threads

  1. Control Arrays in VB.NET
    By Gary Nelson in forum .NET
    Replies: 277
    Last Post: 10-01-2003, 12:00 AM
  2. Copy/Duplicate Arrays
    By Steve Cochran in forum .NET
    Replies: 8
    Last Post: 10-18-2002, 12:10 PM
  3. Replies: 15
    Last Post: 05-09-2001, 04:40 AM
  4. VB Arrays and memory allocation
    By Brian Leung in forum VB Classic
    Replies: 12
    Last Post: 06-20-2000, 03:06 PM
  5. VB Arrays and memory allocation
    By Brian Leung in forum VB Classic
    Replies: 0
    Last Post: 06-20-2000, 09:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center