1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
elena-s [515]
3 years ago
15

Given two Strings String s1 = "11223351638791377189728193"; String s2 = "983763978669976862724569282405742578"; and String varia

ble s3. Write a piece of code so that s3 refers to a String whose integer value will be the product of integer values of s1 and s2. Java.
Computers and Technology
1 answer:
inn [45]3 years ago
7 0

Answer:

import java.math.BigInteger;  

public class Main {  

public static void main(String[] args)  {  

String s1 = "11223351638791377189728193";   String s2 = "983763978669976862724569282405742578";

BigInteger num1 = new BigInteger(s1);  

BigInteger num2 = new BigInteger(s2);  

BigInteger product = num1.multiply(num2);  

String s3 = product.toString(10);

System.out.println(s3);  

}  

}  

Explanation:

Because s1 and s2 contain large integers, the program need the biginteger module in other to compute the products of s1 and s2 when converted to integers.

This line initializes the two string variables s1 and s2

String s1 = "11223351638791377189728193";   String s2 = "983763978669976862724569282405742578";

The next two lines convert the two strings to BigInteger. This allows the program to multiply large integers

<em> BigInteger a = new BigInteger(s1);   </em>

<em>BigInteger b = new BigInteger(s2);  </em>

<em />

This computes the product of the two big integers

BigInteger product = num1.multiply(num2);  

This converts the product to String s3

String s3 = product.toString(10);

This prints s3

System.out.println(s3);  

}  

}  

You might be interested in
Rounding up and down for 389,422
elena-14-01-66 [18.8K]

Answer:

389420

389430

Explanation:

the up is for 389430

the down is for 389420

4 0
3 years ago
the term that is used to describe how many bits are used in each pixel to show the number of colours used
Korolek [52]
Colour depth?????????????????????                              .
8 0
4 years ago
What to do if you click on a phishing link on iphone
gregori [183]

Answer:

Nothing, just exit out of it

Explanation:

5 0
3 years ago
Read 2 more answers
When did outdoor air pollution first become a significant problem?
zmey [24]
Out door air pollution has been a problem since ancient Romans...but the industrial revouloution was when outdoor air pollution increased and it a significant problem...
hope this helps
6 0
3 years ago
HELP PLS TIME LIMIT HERE
Novosadov [1.4K]
I do it immediately, so it don’t effect my assignments or grades.
7 0
3 years ago
Other questions:
  • What types of information would be entered in a Microsoft Word table ?
    11·1 answer
  • Open source software is copyrighted software that is distributed at no cost for a trial period.
    11·1 answer
  • You resurrected an old worksheet. It appears to contain most of the information that you need, but not all of it. Which step sho
    5·1 answer
  • ) How many switching functions of two variables (x and y) are there?
    11·1 answer
  • A queueing system has four crews with three members each. The number of "servers" is:
    5·2 answers
  • Consider three different processors P1, P2, and P3 executing the same instruction set. P1 has a 3 GHz clock rate and a CPI of 1.
    8·1 answer
  • if a user has one column in a table and would like to make it into two columns which command should be used
    13·1 answer
  • If you have an equipment failure while driving on an expressway, you should
    8·1 answer
  • Gus has decided to organize his inbox on June 26 by using folders and deleting irrelevant messages. He creates a folder called "
    12·2 answers
  • Brain for free 12628397
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!