Home Answers Viewqa Java-Beginners java string multiplication

 
 


Java Coder
java string multiplication
2 Answer(s)      a year and 3 months ago
Posted in : Java Beginners

Is there any simple method of string multiplication in java ..?

View Answers

February 13, 2012 at 3:25 PM


public class StringMultiplication {
public static void main(String[] args) {
    String number1 = "17";
    String number2 = "15";

    char[] n1 = number1.toCharArray();
    char[] n2 = number2.toCharArray();

    int result = 0;
    for (int i = 0; i < n1.length; i++) {
        for (int j = 0; j < n2.length; j++) {
            result += (n1[i] - '0') * (n2[j] - '0')* (int) Math.pow(10, n1.length * 2 - (i + j + 2));
        }
    }
    System.out.println(result);
}
}

February 13, 2012 at 3:25 PM


import java.math.*;

public class StringMultiplication {
public static void main(String[] args) {
    String number1 = "17";
    String number2 = "15";

    BigInteger num1=new BigInteger(number1);
    BigInteger num2=new BigInteger(number2);
    BigInteger result=num1.multiply(num2);
    System.out.println(result);
}
}









Related Pages:
multiplication
multiplication  multiplication of two number numbers entered by user minimum 100digits using GUI   Java Multiplication of two 100 digits... java.awt.event.*; class SwingMultiplication { public static void main(String
multiplication
multiplication  multiplication of two number numbers entered by user minimum 100digits using GUI   Java Multiplication of two 100 digits... java.awt.event.*; class SwingMultiplication { public static void main(String
java string multiplication
java string multiplication  Is there any simple method of string multiplication in java ..?   public class StringMultiplication { public static void main(String[] args) { String number1 = "17"; String number2
Multiplication table
Design and develop Multiplication table in Net beans  Design and develop a program that will print a multiplication table. The program should: Ask the user for ending number than it must Display that particular multiplication
Multiplication table
number than Display that particular multiplication table   import java.util.Scanner; class Multiplication { public static void main(String args...Multiplication table  Using Net beans Design and develop a program
Multiplication table
Multiplication table Net Beans  Using Net beans Design and develop... for ending number than Display that particular multiplication table   import java.util.Scanner; class Multiplication { public static void main
Multiplication of two polynomials using linked list in java
Multiplication of two polynomials using linked list in java  I am doing a program "Multiplication of two polynomials using linked list in java... main(String [] args){ Polynomial poly1 = new Polynomial(); Polynomial poly2 = new
Matrix multiplication in java
Matrix multiplication in java In this section we will learn about multiplication of two matrices. In java this is a simple program to multiply two matrices... two-dimensional array. Here we are going to develop a Java code for matrices
Multiplication problem - Java Beginners
Multiplication problem  I am facing a peculiar problem in java regarding a multiplication. Please see below: 19300 * 0.001 = 19.3 19400 * 0.001 = 19.400000000000002 (why is this ??) 19500 * 0.001 = 19.5 Can anybody help
multiplication algorithms in java divide and conquer
multiplication algorithms in java divide and conquer  I need multiplication algorithms in java divide and conquer ask from user input two numbers in binary then the program multiply two number use multiplication algorithm in java
multiplication algorithms in java divide and conquer
multiplication algorithms in java divide and conquer  I need multiplication algorithms in java divide and conquer ask from user input two numbers in binary then the program multiply two number use multiplication algorithm in java
multiplication algorithms in java divide and conquer
multiplication algorithms in java divide and conquer  I need multiplication algorithms in java divide and conquer ask from user input two numbers in binary then the program multiply two number use multiplication algorithm in java
java program_big digits multiplication..
java program_big digits multiplication..  i want program about big digits multiplication program using java..plz tel me answer
parallel dense matrix multiplication
using dense parallel matrix multiplication. I request you to kindly provide me a code for Parallel Matrix multiplication on distributed systems using Java
Create Multiplication Table from 1 to 10
Create Multiplication Table in Java In this section, you will learn how to create multiplication table from 1 to 10. For this purpose, we have created...(String[] args) { int[][] array = new int[11][11
code for multiplication of matrix in java using methods
code for multiplication of matrix in java using methods  code for multiplication of matrix in java using methods
print the multiplication table up to one
Multiplication { public static void main(String args[]) { int n, c...;import java.util.Scanner; class Multiplication { public static void main(String...print the multiplication table up to one  My problem is that I have
How to Create Multiplication Table from 1 to 10?
How to Create Multiplication Table from 1 to 10?  Hi, I want to develop an small application store products. So, i how to create multiplication table 1 to 10. Please suggest online example related to creating multiplication
Java Matrix Multiplication Example
Java Matrix Multiplication Example In this tutorial, you will learn how... the multiplication of two matrices of any order. In the given program, firstly we have... the multiplication of two matrices, we have performed following distinctive steps
string
string   difference detween "public static void main (String[] args) " and "public static void main (String args[])" in java but it executes both ,in java which one is legal   The only difference is style, where
string
string  java prgm to find total occurence of a given string pattern in a sentence
string
string  java prgm to find total occurence of a given string pattern in a sentence
String
String  How to Convert sunnapu gopal to Sunnapu Gopal in java using String
Multiplication of two Matrix
Multiplication of Two Matrix       This is a simple Java multidimensional array program.... The Java two dimensional array  program is operate to the two matrix number
Multiplication of two Matrix
Multiplication of two Matrix        This is a simple java program that teaches you for multiplying two matrix to each other. Here providing you Java source code
string
string  a java program using string function to input any string... ArrangeStringAlphabetically { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.print("Enter string
string
string  a java program using string function that computes your... links: http://www.roseindia.net/tutorial/java/core/printInitials.html http://www.roseindia.net/answers/viewqa/Java-Beginners/13383-print-initials.html
string
string  how do i extract words from strings in java???   Hi... ExtractWords { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.print("Enter String
string
string  a java program to input a string and display the string...*; import java.io.*; public class FirstLetter{ public static String capitalizeFirstLetter( String str ) { final StringTokenizer st = new StringTokenizer( str
string
and also displaying that contain word? Like I want to find "a" in the string "This is example of java Programme" and also display word that contain "a" character.   Here is a java example that accepts a sentence from the user
string
string  program for String reverse and replace in c,c++,java e.g.Input:10,20,hello output:hello;20;10   Hi Friend, Try the following java...(String[] args) { String array[]=new String[5]; Scanner input
string
string  how we conunt the no. of words in java without using in pre defined method in java
string
string  a java program to replace all matching substrings
string
string  a java program using string function and access modifiers to automate the insurance company which will have to manage the information about policy holders Data Members: 1)Policy No 2)Name of policy holder 3)Address 4
code for a simple java program which performs basic arithmetic operation addition,subtraction,multiplication,division........
code for a simple java program which performs basic arithmetic operation addition,subtraction,multiplication,division........  code for a simple java...,multiplication,division
Matrix multiplication
Matrix multiplication  program to read the elements of the given two matrices of order n*n and to perform the matrix multiplication
Java biginteger to String
Java biginteger to String     ... BigIntegerString.java C:\biginteger>java BigIntegerString Result(in String... variable to the BigInteger similarly we can convert the BigInteger to String
Java string
Java string  Strings are immutable.But String s="Hello"; String s1=s+"World"; S.O.P(s1); means printing "Hello World". How
Java String
Java String  You are given two strings S1 and S2,Delete from S2 all those characters which occur in s1 also and create a clean S2 with the relevant characters deleted..write a pgm for this..pls send as soon as possible Thank you
Java String
Java String       In this section, you will learn about the java string. Java String is a set... to a string literal in the object stream. The Java String object contains a sequence
Java String - Java Beginners
Java String  How to seperate the string into characters.  there is a method called getChars() in String class,plz use that and separate into characters so plz verify the String api for related questions 
string - Java Beginners
string in java interview questions  What is string in java? Interview questions
string manipulation
string manipulation  Write a program in java and accept 10 strings form the user. store them in an array. then find the string with the maaximum length and print
String in Java - Java Beginners
]); } } } ---------------------------------------------------- I am sending simple code of String array. If you are beginner in java...String in Java  hiiiii i initialise a String array,str[] with a size... in advance   Hello Antony Insted Using String Array Use StringBuffer
string prgm
string prgm  write a java program which read a sentence and print occurence of each vowels in it seperatly
string wap
string wap  WAP to convert stack trace in to a String . Write that Stack Trace in Error Log File along with the class name and Method Name that has thrown the error.in java language
Multiplication of Two Number in Class
Multiplication of Two Number in Class       This section we will learn how to use...; java program also provide complete illustration with source code. 
Java string buffer
Java string buffer  what is stringBuffer and StringBuilder
How to convert into to String in Java?
How to convert into to String in Java?  Hi, How to convert into to String in Java? Thanks
String immutable - Java Beginners
String immutable  Why is String immutable?  See here Why String is immutable in Java

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.