-4

I wanted to divide the integer and store it in an array

For Ex:1000000000000 into two indexes

arr[0]=1000000 arr[1]=000000

but arr[1] stores it as 0 instead of 0000000.

I wanted to perform some operations with it,so i needed 7 zeros in it ,instead of 1 zero.

Is it achievable in some way ?

Ramgopal
  • 21
  • 9

1 Answers1

0

Convert your number to a string then use substring() to split it up.

long num = 1000000000000L;
String str = num + "";

String[] array = new String[2];

array[0] = str.substring(0, 6);
array[1] = str.substring(7);
spencer.sm
  • 19,173
  • 10
  • 77
  • 88