0

How to convert int value into string means my string will be 42646 character its mod 42600 how to show and print this character and how?

int count = image_length.length(); //count=42646
System.out.println(count);
int mod = count % length; //46
int rem = count - mod; //42600
String rem_value = String.valueOf(rem);
// I want to get string through reminder value 42600 & how
String[] split = rem_value.split("[^a-zA-Z/]", length);

getSaltString();

photoName = randStr + "_IMG.jpg";
StringBuilder stringBuilder = new StringBuilder();

for (int i = 0; i < split.length; i++) {

    url_part = String.valueOf(stringBuilder.append(split[i]));
    new RegisterImageThread(ActivityRegisterUploadPhoto.this).execute(photoName, url_part + i);
}
new RegisterImageThread(ActivityRegisterUploadPhoto.this).execute(photoName, url_part+rem_value);
RamenChef
  • 5,557
  • 11
  • 31
  • 43
Dipa Gove
  • 23
  • 3

1 Answers1

0

So you want to split the numeric String "42600" to an array right? Replace the line:

String[] split = rem_value.split("[^a-zA-Z/]", length);

to something like this:

    String rem_value = "42600"; //your rem_value
    int[] split = new int[rem_value.length()];
    for (int i = 0; i < rem_value.length(); i++) {
        split[i] = Character.getNumericValue(rem_value.charAt(i));
    }

    //print the result
    Arrays.stream(split).forEach(s -> System.out.println(s));
pleft
  • 7,567
  • 2
  • 21
  • 45