Receipts never show a whole card number. Write CardMask: read one line containing a 16-digit card number that may be typed with spaces or dashes (6222-0212 3456 7890). Remove the separators, then print the number of digits, the number grouped by four, the masked form, the first six digits (the bank code), the first digit as a number, and whether it starts with 62.
For the input
6222-0212 3456 7890
the program prints
Digits: 16
Grouped: 6222 0212 3456 7890
Masked: **** **** **** 7890
Bank code: 622202
First digit: 6
Starts with 62: true
Use replace, substring, length, charAt and startsWith — no loops.