Matches of numbers into another array JAVA -
i have put integer matches in numbers of array , array, not have same position in array. example: have these 2 arrays of numbers:
4578 7539
it means have 1 number in same position (5), , number 7 in first array not in same position, case must increment 1 in integer.
if in same position number 5, did this:
int introducido = integer.parseint(numero.gettext()); (int = 0; < string.valueof(introducido).length(); i++) { int entero = integer.parseint("" + numero.gettext().charat(i)); string temp = integer.tostring(numaleatorio); int intarrnumeros = integer.parseint("" + temp.charat(i)); if (intarrnumeros == entero) { fijas++; }
but don't know how if not in same position.
upd working non-unique symbols in input strings
try code
pattern = "4578 "; string tofind = "7539"; int sameposition = 0; int notsameposition = 0; (int = 0; < tofind.length(); ++i) { char digit = tofind.charat(i); if (pattern.contains(string.valueof(digit))) { if (pattern.charat(i) == digit) { ++sameposition; } else { ++notsameposition; } } }
Comments
Post a Comment