Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to convert a Double array to a String array in java?
You can convert a double array to a string using the toString() method. To convert a double array to a string array, convert each element of it to string and populate the String array with them.
Example
import java.util.Arrays;
public class DoubleArrayToString {
public static void main(String args[]) {
Double[] arr = {12.4, 35.2, 25.6, 98.7, 56.4};
int size = arr.length;
String[] str = new String[size];
for(int i=0; i<size; i++) {
str[i] = arr[i].toString();
System.out.println(str[i]);
}
}
}
Output
12.4 35.2 25.6 98.7 56.4
Advertisements