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
The process of learning by making mistakes and by trial and error is called _____.
vodomira [7]
I believe it’s problem solving.
6 0
3 years ago
Can someone help me with these two
Digiron [165]

upper question:

false

lower question:

25

26

-10

7 0
3 years ago
5 band resistor with two red bands, two gold bands, one purple band?
Mamont248 [21]

According to below picture, two gold bands on a 5 band resistor cannot happen. What is the order of the bands?

8 0
3 years ago
Not a subject question but please help
Doss [256]

Answer:

You go to account settings, edit your profile and click preferences and then go to choose level and put which grade u are in the options r middle school, high school, and college

Explanation:

8 0
3 years ago
Read 2 more answers
I'm looking for a new laptop for school. Which laptop would be the best. Right now I have a chromebook and it is broken. 
Y_Kistochka [10]
Any HP laptop would be good! What is your price range?
Also, if it is for school, have you considered getting an iPad? It is great for taking notes and looking stuff up and being portable. My friends currently use it
3 0
3 years ago
Read 2 more answers
Other questions:
  • Why is a cable modem classified as a digital model?
    12·1 answer
  • How to write equal to or greater than in word?
    9·1 answer
  • The ________ is a consortium of organizations that develops web protocols and sets standards.
    7·1 answer
  • Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation
    6·1 answer
  • Suppose that a computer can run an algorithm on a problem of size 1,024 in time t. We do not know the complexity of the algorith
    14·1 answer
  • If your computer system is not working correctly, you can use System Restore to return the ___________ ____________ to an earlie
    10·1 answer
  • True of False - use T or F The Math class can be instantiated.
    15·1 answer
  • Is the process of modifying something to make it fit certain criteria.
    11·1 answer
  • Mention some of the codes of conduct of Information Technology (IT)​
    11·1 answer
  • I'm pretty sure most of you know squid game, right? Well, are the actors really dying? or is it just CGI or effects? Because it'
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!