Total members 11890 |It is currently Fri Apr 19, 2024 7:26 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Can you guys help me on how to change an integer type of array into a
char type array is there a simple code of type casting array?




Author:
Proficient
User avatar Posts: 280
Have thanks: 1 time

You'll have to do a loop and cast each element as you move it.
An example method to do this:
Code:
public char [] toCharArray (int [] intArray) {
char [] charArray = new char [intArray.length];
for (int i = 0; i < intArray.length; i++) {
charArray [i] = (char)intArray [i];
}
return charArray;
}


Using Java 5 and above, you can parameterize this code:

_________________
Please recommend my post if you found it helpful


Author:
Proficient
User avatar Posts: 228
Have thanks: 0 time
Post new topic Reply to topic  [ 2 posts ] 

  Related Posts  to : Array Casting in java
 Casting Variables in php     -  
 casting to char + end of file     -  
 Java Two Dimensional Array     -  
 Adding vertical array in java     -  
 quicksort algorithm implementation java code- array sorting     -  
 Bubble Sort Algorithm Java Implementation Code-Sorting Array     -  
 Array difference for associate array     -  
 Sort strings java-Sorting Array of Strings     -  
 compare an array with another array?     -  
 Array size to zero     -  



Topic Tags

Java Arrays
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com