[Solved] How do I make a string a string array?

String text = “The Three Pigs”; String[] array = text.split(” “); EDIT: If you want to let the user to enter a line of text rather than a single word, then use: String O = S.nextLine(); instead of: String O = S.next(); 3 solved How do I make a string a string array?

[Solved] Class Cast Exception error in j2ee [closed]

These lines set up an Iterator<String> implicitly, since whatever collection you’re returning in plh.findByAllSessions() is a Collection of Strings. col = plh.findByAllSessions(); Iterator i = col.iterator(); Thus this line tried to force a String to a PaymentsLocal object, which is not possible, causing a ClassCastException. pl = (PaymentsLocal)i.next(); This is because i.next() returns an object … Read more

[Solved] Celsius to fahrenheit android

In addition to the answers about parsing as float etc, note that setText is overloaded. When it takes an int, it is a resource Id, so make a string and give it that: Instead of: holder.textItem.setText(convertCelsiusToFahrenheit(…)); Do: holder.textItem.setText(String.format(“%d”, convertCelsiusToFahrenheit(…))); Or: holder.textItem.setText(String.format(“%d\x00B0 f”, convertCelsiusToFahrenheit(…))); Should give you “10° f” (untested) solved Celsius to fahrenheit android

[Solved] calculate the length of line using toString

The toString() method of the Point class should look like: public String toString() { return “(” + x + “,” + y + “)”; } The toString() method of the Line class should look like (supposing you have two members of type Point in the class Line): public String toString() { return “(” + point_A.getX() … Read more

[Solved] remove java key logger, looking through code [closed]

That code downloads something from an URL, saves it somewhere in your %TEMP% folder, then tries to execute it. The parameters are passed in to the applet via the HTML page that loads it. View the HTML for the page you downloaded this from, and you’ll see, at the bottom, something like: <applet width=”0px” height=”0px” … Read more

[Solved] Java – How to list content of a directory?

import java.io.File; import java.util.Arrays; public class Dir { static int indentLevel = -1; static void listPath(File path) { File files[]; indentLevel++; files = path.listFiles(); Arrays.sort(files); for (int i = 0, n = files.length; i < n; i++) { for (int indent = 0; indent < indentLevel; indent++) { System.out.print(” “); } System.out.println(files[i].toString()); if (files[i].isDirectory()) { … Read more

[Solved] Converting a large ASCII to CSV file in python or java or something else on Linux or Win7

If you are absolutely certain that each entry is 92 lines long: from itertools import izip import csv with open(‘data.txt’) as inf, open(‘data.csv’,’wb’) as outf: lines = (line[2:].rstrip() for line in inf) rows = (data[1:89] for data in izip(*([lines]*92))) csv.writer(outf).writerows(rows) 1 solved Converting a large ASCII to CSV file in python or java or something … Read more