Guest User

Untitled

a guest
Jan 23rd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. // receive as input a string of length 16, actually receives 16 digits
  2. // then send each digit to a new array where each digit is a int element
  3.  
  4. public class test2 {
  5.  
  6.  
  7.  
  8. public static void main(String args[]) {
  9. int arr[] = new int[16];
  10.  
  11.  
  12. String n = "1234567891111113";
  13. for(int x=0; x<n.length(); x++) {
  14. arr[x] = Integer.parseInt(n.substring(x,x+1));
  15.  
  16. }
  17.  
  18.  
  19. for(int a: arr) {
  20.  
  21. System.out.print(a + "-"); }
  22. System.out.println();
  23.  
  24.  
  25. }
  26.  
  27.  
  28. }
Add Comment
Please, Sign In to add comment