java large digital computing

 

 | - code examples

. 1  / ** 
2  * 9527 :: @auther
 . 3  * @Description: learning algorithm
 . 4  * @program: OOP
 . 5  * @Create: 2019-09-12 23:48
 . 6   * / 
. 7  public  class the Test {
 . 8      public  static  void main (String [] args) {
 . 9          // multiplier 
10          int multiplier the = 358 623 965 ;
 . 11          // multiplicand 
12 is          int multiplicand, = 200 203 679 ;
 13 is          // number after receiving the transformed using a variable 
14          String [] TEMP = Test.change (multiplier The);
 15         for ( int I = 0; I <temp.length; I ++ ) {
 16              // string numbers on each digit and converted to integer number multiplied by the multiplier 
. 17              int Center = the Integer.parseInt (TEMP [I]) * multiplicand,;
 18 is              // re memory array 
. 19              TEMP [I] = Integer.toString (Center);
 20 is          }
 21 is          for ( int I = temp.length -. 1; I> = 0; i-- ) {
 22 is              int Center = the Integer.parseInt (TEMP [I]);
 23 is              int nextCentre = 0 ;
 24              IF (I -. 1> 0 ) {
 25                 = the Integer.parseInt nextCentre (TEMP [I -. 1 ]);
 26 is                  TEMP [I] = Integer.toString (Center 10% );
 27                  TEMP [I -. 1] = Integer.toString (nextCentre + Center / 10 );
 28                  / / set about, preventing the array bounds exception 
29              } the else  IF (I -. 1 == 0 && the Integer.parseInt (TEMP [I]) / 10> 10 ) {
 30                  System.out.println ( "less than the number of bits required to redesign given array length " );
 31 is                  BREAK ;
 32              }
 33 is          }
 34 is  
35          // output 
36          for(String S: TEMP) {
 37 [              of System.out.print (S);
 38 is          }
 39  
40          System.out.println ( "\ n-\ n-Here are the results of calculations with the long long integer, for checking the above algorithm results " );
 41 is          Long A = 358 623 965 ;
 42 is          Long B = 200 203 679 ;
 43 is          System.out.println (" standard answer; "A * + B);
 44 is      }
 45  
46 is  
47      / ** 
48       *
 49       * @param NUM input an integer number of
 50       * @return   return large numbers into the array of arrays
 51 is       * / 
52 is      public static String [] Change ( int NUM) {
 53 is          // declare an array 20 of a length 
54 is          String [] temp = new new String [25 ];
 55          // declare an integer n, used temp counter 
56 is          int n-=. 1 ;
 57          // incoming large numbers into a single number 
58          String [] = Transfer Integer.toString (num) .split ( "" );
 59          // reverse traversal num converted into String array, this array into the affirmed array 
60          for ( int I = transfer.length -. 1; I> = 0; i-- ) {
 61 is              // reverse placed, this time, n-decreasing variable is used in the digital 
62             TEMP [temp.length - n-] = Transfer [I];
 63 is              n-+ =. 1 ;
 64          }
 65          // replaced tmep array null string of "0" 
66          for ( int I = 0; I <TEMP. length; I ++ ) {
 67              IF (TEMP [I] == null ) {
 68                  TEMP [I] = "0" ;
 69              }
 70          }
 71 is          return TEMP;
 72      }
 73 is }
Large digital computing --- lazy, did not write back method steps

 

Guess you like

Origin www.cnblogs.com/twuxian/p/11516597.html