Hackerss.com is a community of amazing hackers

Hackerss is a community for developers, data scientitst, ethical hackers, hardware enthusiasts or any person that want to learn / share their knowledge of any aspect of digital technology.

Create account Log in

Posted on

Convert long to string in Java

Convert long to string - Java:

import java.io.*;

public class LongToString {
   * This method convert long to string.
   * @param numberOne first param to convert.
   * @return String Obtains the string of numberOne.
   public String longToString(long numberOne) {
       //Variable to store the string
       String str = "";
       //Convert the long to string
       str = String.valueOf(numberOne);
       //Return the string
       return str;

   * One Example
   public static void main(String args[]) throws IOException {

      LongToString  longToString= new LongToString ();
      String str = longToString.longToString(10);
      System.out.println("10 is :" + str); //10

Enter fullscreen mode Exit fullscreen mode

Top comments (0)