answersLogoWhite

0

In Java, you would create an array of type BigInteger, then initialize each object (each array element) with the newoperator. I believe it would be something like this: BigInteger[] myArray = new BigInteger[5]; for (int i = 0; i

User Avatar

Wiki User

15y ago

What else can I help you with?

Continue Learning about Engineering

Addition of two numbers without using operators in java?

I don't think this can be done. Why do you want to do it without operators, anyway? It is fairly simple to use them. - Of course, you could write a method that adds two numbers, but your method will internally still have to use operators. ----------------------------------------- Reply by lordstriker24@yahoo.com import java.math.BigInteger; public class MultiplyTest { public static void main(String[] args) { BigInteger bigInt1 = new BigInteger("5"); BigInteger bigInt2 = new BigInteger("8"); System.out.println(bigInt1.add(bigInt2)); } }


Write a method that returns the gcd of an unspecified number of integers. The method header is specified as follows public ststic int gcd int... numbers?

There are many ways of solving this problem using primitive types. However, if you are willing to sacrifice some memory, you can use BigInteger's gcd() method to make things easy. Example: public static int gcd (int[] numbers) { BigInteger k = BigInteger.ZERO; for (int n : numbers) k = k.gcd(new BigInteger(""+n)); return k.intValue(); }


Dynamically allocated array waste storage and time?

It's actually not true. In order to make a good program which can work with big arrays you have to use dynamic arrays because you can cleam memory used by dymanic arrays any time. For static arrays is not true, memery which was reserved for static arrays will be available for other applications only when you finish working with your application (which is working with static arrays).


Why do you use ampersand symbol for arrays and not for a string?

You don't need to use ampersand for arrays; it's entirely optional even for strings (character arrays). This is because arrays will implicitly convert to a pointer at the slightest provocation. Thus for an array named X, you can either pass the array to a function as X, &X or &X[0], they all refer to the exact same address.


How you can multiply 3x24 by using arrays?

Sir, your question is not clear. If you just want to multiply 3 and 24 then why are you trying to use arrays for such simple calculation.

Related Questions

How two very large integers can multiply in java language?

Java has a built-in arbitrary-precision integer class called BigInteger. BigInteger can take a number in String format and represent it as a number. // First huge number (larger than can be held in a Long). BigInteger bigIntA = new BigInteger("123456789012345678901234567890"); // Second huge number BigInteger bigIntB = new BigInteger("987654321098765432109876543210"); // bigIntAB = bigIntA * bigIntB BigInteger bigIntAB = bigIntA.multiple(bigIntB);


Write a C program for sum of two numbers without using operator?

import java.math.*; class AddNumbers { public static void main(String[] args) { BigInteger num1=new BigInteger("100"); BigInteger num2=new BigInteger("50"); BigInteger result=num1.add(num2); System.out.println(result); } }


Name two smaller arrays you can use to find the product of 8x6?

name two smaller arrays you can use to find the product


How do you write a program in java that prints 2 to the power of 999?

Fortunately for us, Java can handle arbitrarily-large numbers via the BigInteger class. This will compute and print out the value of 2999 final BigInteger TWO = BigInteger.valueOf(2L); final int exponent = 999; final BigInteger answer = TWO.pow(exponent); System.out.println(answer);


Why do you use antenna arrays?

To improve the signal :)


What does 787139672895145817457845871514785187457814578452874514785157458475142785481751247854times 72489724198724894127891247419874187148971428912471489?

using BigInteger in Java the solution came out to 57059537794043649407224429209731939614293432863825926865326985015341245046424688863610945101859121700977706958317102987733458968947434606


Addition of two numbers without using operators in java?

I don't think this can be done. Why do you want to do it without operators, anyway? It is fairly simple to use them. - Of course, you could write a method that adds two numbers, but your method will internally still have to use operators. ----------------------------------------- Reply by lordstriker24@yahoo.com import java.math.BigInteger; public class MultiplyTest { public static void main(String[] args) { BigInteger bigInt1 = new BigInteger("5"); BigInteger bigInt2 = new BigInteger("8"); System.out.println(bigInt1.add(bigInt2)); } }


Write a method that returns the gcd of an unspecified number of integers. The method header is specified as follows public ststic int gcd int... numbers?

There are many ways of solving this problem using primitive types. However, if you are willing to sacrifice some memory, you can use BigInteger's gcd() method to make things easy. Example: public static int gcd (int[] numbers) { BigInteger k = BigInteger.ZERO; for (int n : numbers) k = k.gcd(new BigInteger(""+n)); return k.intValue(); }


How can you use arrays to determine if a number prime or composite?

Yes


How do you use arrays and expanded algorithm like 29x47?

1363


What is difference between Bac arrays and DNA arrays?

BAC (Bacterial Artificial Chromosome) arrays are a type of DNA arrays. BAC arrays are usually used for a technique called array CGH (Comparative Genomic Hybridisation) which is used to identify gross deletions or amplifications in DNA (which for example is common in cancer). DNA arrays include BAC arrays but also oligo, cDNA, and promoter arrays. Oligo and cDNA arrays are typically used for gene expression analysis (looking to see how heavily expressed each gene is). Oligo arrays can also be used for SNP (single nucleotide polymorphism) analysis. Promoter arrays are used to identify transcription factor binding sites.


Dynamically allocated array waste storage and time?

It's actually not true. In order to make a good program which can work with big arrays you have to use dynamic arrays because you can cleam memory used by dymanic arrays any time. For static arrays is not true, memery which was reserved for static arrays will be available for other applications only when you finish working with your application (which is working with static arrays).