/** * Created by leon on 1/29/18. */ import java.util.Arrays; public class StringArrayUtils { /** * @param array array of String objects * @return first element of specified array */ // TODO public static String getFirstElement(String[] array) { String first = ""; first += array[0]; return first; } /** * @param array array of String objects * @return second element in specified array */ public static String getSecondElement(String[] array) { String second = ""; second += array[1]; return second; } /** * @param array array of String objects * @return last element in specified array */ // TODO public static String getLastElement(String[] array) { String last = ""; last += array[array.length-1]; return last; } /** * @param array array of String objects * @return second to last element in specified array */ // TODO public static String getSecondToLastElement(String[] array) { String secLast = ""; secLast += array[array.length-2]; return secLast; } /** * @param array array of String objects * @param value value to check array for * @return true if the array contains the specified `value` */ // TODO public static boolean contains(String[] array, String value) { boolean contain = false; for(String s : array){ if(s==value){ contain = true; } } return contain; } /** * @param array of String objects * @return an array with identical contents in reverse order */ // TODO public static String[] reverse(String[] array) { String reversal; for(int i = 0; i