Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. 0000000000000000000000203
  2.  
  3. 0000000000000000000000045
  4.  
  5. 0000000000000000000000010
  6.  
  7. 0000000000000000000000258
  8.  
  9. //Every array will be 25 digits long. Mostly zeroes with the numbers to add at the
  10. //end
  11. public static final int ARRSIZE = 25;
  12.  
  13. public static void addStuff(String[] stuff) {
  14. String[] result = new String[ARRSIZE];
  15. int[] holder = new int[ARRSIZE];
  16. String temp = "";
  17. int area = 0;
  18. int carry = 0;
  19. for(int i = 0; i < stuff.length; i++)
  20. {
  21. for(int j = 0; j < stuff.length; j++)
  22. {
  23. temp = stuff[j].substring(stuff[i].length() - 1-i, stuff[i].length()-i);
  24. area += Integer.parseInt(temp);
  25. if(area >= 10)
  26. {
  27. carry = area/10;
  28. holder[ARRSIZE - 1-i] = area%10;
  29. area = 0;
  30. }
  31. carry = 0;
  32. }
  33.  
  34.  
  35. }
  36.  
  37. //TODO: Make int[] holder -> String[] result
  38. //Take result String[] to future method
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement