0

Toll Free number in Java

prefix = phoneNumber/10000000; firstPart = (phoneNumber % 10000000) / 10000 secondPart = phoneNumber % 10000 What to these calculations determine? Or Can someone help break this down ?

20th Oct 2019, 5:26 PM
Andy M
Andy M - avatar
4 Answers
+ 3
I don't know the length of the phone number. As an example I take 12345678: number / 10000000 = 1 % is the modulus operator. It gives you the remainder of a division: number % 10 = 8 number % 100 = 78 number % 1000 = 678 and so on... If you do the calculations: prefix = 1; firstPart = 234; secondPart = 5678 You are splitting a number into three parts.
20th Oct 2019, 6:24 PM
Denise RoƟberg
Denise RoƟberg - avatar
+ 1
20th Oct 2019, 6:38 PM
Andy M
Andy M - avatar
0
Why don't you try some values for phoneNumber and find out yourself? Hint: phoneNumber is an integer (or long) . Try different length of numbers (longer than 8 digits).
20th Oct 2019, 6:07 PM
Thoq!
Thoq! - avatar
0
May be regularExpression may help you?
3rd Jul 2020, 11:10 AM
Š®Ń€ŠøŠ¹ Š¤ŠµŠ“Š¾Ń€Š¾Š²
Š®Ń€ŠøŠ¹ Š¤ŠµŠ“Š¾Ń€Š¾Š² - avatar