Answer:
class Main {
public static void main(String[] args) {
if (args.length > 0) {
long count = args[0].chars().filter(ch -> ch == '7').count();
System.out.println("Number of sevens " + count);
}
}
}
Step-by-step explanation:
That would do the trick. Drop a comment if you need more explanation. It requires Java 8 because of the lambda expression. What happens is that the input is treated as a string rather than a number, because we're looking for 7's. Convert it to an array of chars, filter out only the chars that are a '7' and count them.