Documentation of 'jminhep.utils.ArrayOps' Java class
ArrayOps
jminhep.utils

Class ArrayOps



  • public class ArrayOps
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor and Description
      ArrayOps() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static int[] copy(int[] nums)
      #12 Make and return a copy of the array nums.
      static int findIndex(double[] nums, double val)
      #5 Find the index of a specific value in an array of integers.
      static int findLargest(double[] A)
      #1 Find the index of the Lagest value
      static int findLargest(double[] A, int boundary)
      #1 Find the index of the Lagest value
      static double findMax(double[] nums)
      #1 Find the largest value in an array of integers.
      static java.lang.String findMax(java.lang.String[] strs)
      #2 Find the largest value in an array of Strings.
      static int findMin(int[] nums)
      #3 Find the smallest value in an array of integers.
      static java.lang.String findMin(java.lang.String[] strs)
      #4 Find the smallest value in an array of Strings.
      static int findSmallest(double[] A)
      #1 Find the index of the Smallest value
      static int findSmallest(double[] A, int boundary)
      #1 Find the index of the Smallest value
      static int findVal(java.lang.String[] strs, java.lang.String str)
      #6 Find the index of a specific value in an array of Strings.
      static void insert(int[] nums, int index, int val)
      #10 Insert val into nums at the specified index.
      static int product(int[] nums)
      #8 Compute and return the product of all of the elements of nums.
      static void remove(int[] nums, int index)
      #9 Remove from nums the value at the specified index.
      static double[] Sort(double[] unsorted)
      Sort array
      static int sum(int[] nums)
      #7 Compute and return the sum of all of the elements of nums.
      static void swapElements(int[] nums, int i, int j)
      #11 Swap the element at index i of nums with the element at index j.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ArrayOps

        public ArrayOps()
    • Method Detail

      • findLargest

        public static int findLargest(double[] A)
        #1 Find the index of the Lagest value
        Parameters:
        nums - an array of integers.
        Returns:
        the largest value in nums.
      • findLargest

        public static int findLargest(double[] A,
                                      int boundary)
        #1 Find the index of the Lagest value
        Parameters:
        nums - an array of integers.
        Returns:
        the largest value in nums.
      • findSmallest

        public static int findSmallest(double[] A)
        #1 Find the index of the Smallest value
        Parameters:
        nums - an array of integers.
        Returns:
        the largest value in nums.
      • findSmallest

        public static int findSmallest(double[] A,
                                       int boundary)
        #1 Find the index of the Smallest value
        Parameters:
        nums - an array of integers.
        Returns:
        the largest value in nums.
      • Sort

        public static double[] Sort(double[] unsorted)
        Sort array
        Parameters:
        nums - an array of integers.
        Returns:
        the largest value in nums.
      • findMax

        public static double findMax(double[] nums)
        #1 Find the largest value in an array of integers.
        Parameters:
        nums - an array of integers.
        Returns:
        the largest value in nums.
      • findMax

        public static java.lang.String findMax(java.lang.String[] strs)
        #2 Find the largest value in an array of Strings.
        Parameters:
        strs - an array of Strings.
        Returns:
        the largest String in strs.
      • findMin

        public static int findMin(int[] nums)
        #3 Find the smallest value in an array of integers.
        Parameters:
        nums - an array of integers.
        Returns:
        the smallest value in nums.
      • findMin

        public static java.lang.String findMin(java.lang.String[] strs)
        #4 Find the smallest value in an array of Strings.
        Parameters:
        strs - an array of Strings.
        Returns:
        the smallest String in strs.
      • findIndex

        public static int findIndex(double[] nums,
                                    double val)
        #5 Find the index of a specific value in an array of integers. If the value occurs more than once the index of the first occurrence is returned.
        Parameters:
        nums - an array of doubles
        val - the value to search for in nums.
        Returns:
        the index of val in nums, or -1 if val does not appear in nums.
      • findVal

        public static int findVal(java.lang.String[] strs,
                                  java.lang.String str)
        #6 Find the index of a specific value in an array of Strings. If the value occurs more than once the index of the first occurance is returned.
        Parameters:
        strs - an array of Strings.
        str - the value to search for in strs.
        Returns:
        the index of str in strs, or -1 if val does not appear in strs.
      • sum

        public static int sum(int[] nums)
        #7 Compute and return the sum of all of the elements of nums.
        Parameters:
        nums - an array of integers.
        Returns:
        the sum of all of the elements of nums.
      • product

        public static int product(int[] nums)
        #8 Compute and return the product of all of the elements of nums.
        Parameters:
        nums - an array of integers.
        Returns:
        the product of all of the elements of nums.
      • remove

        public static void remove(int[] nums,
                                  int index)
        #9 Remove from nums the value at the specified index. All of the values in nums with indices greater than index must be shifted down by 1 index to fill in the empty space.
        Parameters:
        nums - an array of integers.
        index - the index of the value to remove from nums.
      • insert

        public static void insert(int[] nums,
                                  int index,
                                  int val)
        #10 Insert val into nums at the specified index. All values in nums with index >= index must be shifted up by one index to make an empty space for val. If the array is full then the value at the maximum index will be lost.
        Parameters:
        nums - an array of integers.
        index - the index at which val is to be inserted.
        val - the value to be inserted into nums.
      • swapElements

        public static void swapElements(int[] nums,
                                        int i,
                                        int j)
        #11 Swap the element at index i of nums with the element at index j.
        Parameters:
        nums - an array of integers.
        i - index of the first number to be swapped.
        j - index of the second number to be swapped.
      • copy

        public static int[] copy(int[] nums)
        #12 Make and return a copy of the array nums.
        Parameters:
        nums - an array of integers
        Returns:
        a new array that is a copy of nums.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.