Skip to main content

Posts

Showing posts with the label conversion

Convert String to Long

Is it possible to convert a String to long without using java's built in function? For instance: String s = "35"; long ans = Long.parseLong(s); How can you carry out the same task without using java's Long.parseLong function

"Encode” integers from an array via a given scheme to characters

Since I'm rather new to Java, I am not familiar with all the ways of handling this type of an assignment. I studied C and C# throughout my high school but I just started Java few days ago. The task goes like this: Write a program that reads 10 single-digit integers and displays a string consisting of 10 characters using the coding scheme: Digit Corresponding Character 0-a 1-b 2-c … … 9-j For example, if input consists of the 10 digits 1 8 6 1 0 3 1 8 5 5, the application responds with "bigbadbiff." Since I moved from C and C# at first I had trouble allowing user to input the integers of the array, but I got that figured out. And this is what I got so far. import java.util.*; public class UnsualCoding { public static void main (String[] args) { Scanner util = new Scanner(System.in); int[] x = new int[5]; int counter = 0; for(int i = 0; i < x.length && util.hasNextInt(); i++) { x[i] = util.nextIn

Creating xml based on html using xslt in java

Please help me i am doing project of file conversion that is converting xml to html using xsl in java and also i need to convert html to xml using the xsl. my first process is got over.but i structed in second part of conversion.. Is there is any possibility to do that conversion.I will tell you the exact flow of the first process... This is my sample xml file: tabl.xml: <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xml" href="testxsl.xsl"?> <mainpara> <epigraph> <para>Though successful research demands a deep <emphasis role="italic">trained</emphasis> <emphasis role="italic">taught</emphasis> to regard. </para> <para>Kuhn (1976, p. 66)</para> </epigraph> <blockquote role="extract"> <para>Though successful research demands a deep commitment to the status quo. <emphasis role="italic">train