Is there a function in java that works like SUBSTRING function but for integers?
java
Solution
Use integer division and the modulus operator:
int input = 456789;
int a = input / 1000;
int b = input % 1000;
Problem
is there a function in java that works like SUBSTRING function but for integers. Like for example the user's input is 456789, I want to break it into two part and put them into different variable. and divide them. for example, user's input : 456789 the first 3 numbers will be in variable A. the last 3 numbers will be in variable B. pass = A/B; can someone help me how can I do this, thanks.