Getting a substring of an array in java -
i want go through int[]
array , substring values it. example if array {1,2,1,4}
want able pull out {1,2}
, compare {1,4}
or want pull out {1,2,1}
, compare {4,1,2}
. problem want go through array , see if "substring" values again shown in array in reverse order.
i know strings have substring(inclusive, exclusive) there similar array or have convert array string in order such thing?
could not identify number set , location form within array wish use , start next index , search first or last number in sequence , once find begin search next number?
ie [1, 4, 5, 1, 3, 1, 4, 2] want take [1, 4] , find it's reverse in array.
starting index 2: [5] != 1 -> [1] == 1 -> [3] != 4 -> [3] != 1 -> [1] == 1 -> [4] == 4, success.
Comments
Post a Comment