About 7,570,000 results
Open links in new tab
  1. Can I multiply strings in Java to repeat sequences?

    May 31, 2017 · The easiest way in plain Java with no dependencies is the following one-liner: new String(new char[generation]).replace("\0", "-") Replace generation with number of repetitions, …

  2. How to Multiply String in Java - Studytonight

    Jan 28, 2021 · In this tutorial, we will learn how to multiply Strings in Java. We will multiply string using String.repeat() and StringBuffer.append() methods

  3. How to Multiply Strings in Java - Delft Stack

    Feb 2, 2024 · In this tutorial, we will learn how we can multiply a string using several methods and examples. The first method to multiply a string is to use the replace() function of the String class.

  4. How to Multiply a String in Java: A Simple Guide - HatchJS.com

    Dec 26, 2023 · In this article, we will show you how to multiply a string in Java using three different methods: Using the `*` operator; Using the `String.repeat()` method; Using the …

  5. How to use string multiplication in Java - Programming …

    In Java, you can use string multiplication to repeat a string multiple times. To accomplish this, you can use the repeat() method introduced in Java 11 or create a simple loop to concatenate the …

  6. java - How to multiply a String by an Integer? - Stack Overflow

    Jan 15, 2016 · You can also always use the .repeat to multiply a string. public static void main(String[] args) { for (int i = 0; i < 10; i++) { System.out.println("*".repeat(i)); } } The …

  7. java - string multiplication - Stack Overflow

    Dec 15, 2010 · One approach is to make an (n + 1) x (m + n) array (strictly an array of arrays), where m and n are the number of digits in each. It will be initialized to 0, and you can use this …

  8. multiplication - Multiply a string in Java - Stack Overflow

    Jan 2, 2011 · Convert the string to a double in order to do the multiplication. Double.parseDouble () is a method you could use. I chose to wrap this in a try block in case the string is malformed …

  9. Multiplying with a string in java - Stack Overflow

    Dec 17, 2012 · Convert the string to whatever number datatype is appropriate (long if a big number, float/double for decimals etc.) using Long.parseLong(String) or …

  10. Multiply Large Numbers represented as Strings | GeeksforGeeks

    Apr 23, 2025 · Approach: Using String Manipulation - (m * n) Time and O (m + n) Space. The overall idea is to simulate the manual multiplication process using string manipulation and …

  11. Some results have been removed
Refresh