im trying to figure out how I can create an if statement that would be true if the the int provided matches any order inputted. For example, if the int is 745, make it so that 754 or 547 or 457 returns true. I was thinking turning into a string and then extracting each char value and adding the char values to make that the comparing value. WOuld that work? Sorry if question is dumb, Im new to java. Thanks in advance
UPDATE
I developed a code that works, except it works when input, for example, 647 and i compare it to 638 since they both have equal char value. how can I fix this?
public int winAmount()
{
int prizeMoney = 0;
String user = Integer.toString(userNumbers);
String winning = Integer.toString(winningNumbers);
int userValue = user.charAt(0)+user.charAt(1)+user.charAt(2);
int winningValue = winning.charAt(0)+winning.charAt(1)+winning.charAt(2);
if (betType.equalsIgnoreCase("Straight Bet"))
{
if (userNumbers == winningNumbers)
prizeMoney = 600 * betAmount;
else
prizeMoney = 0 ;
}
else
{
if (userValue==winningValue)
{
if (user.charAt(0)==user.charAt(1) || user.charAt(0)==user.charAt(2) || user.charAt(1)==user.charAt(2))
prizeMoney = 200 * betAmount;
else
prizeMoney = 100 * betAmount;
}
}
return prizeMoney;
}
}