Filename is "htb.java".
Here is the code:-

import java.io.*;
import java.util.*;
import java.lang.*;


public class htb{
public static void main(String[] args) throws Exception{
File f= new File("dyna.txt");
BufferedReader in = new BufferedReader(new FileReader(f));
String[] line = new String[40000];


line[0]  = in.readLine();
int i=0;
while(line!=null)
line[++i] = in.readLine();
String[] mem_add=new String[100000];
String[] binary=new String[100000];
for(int k=0;k<i;k++){
String[] s4=line[k].split(" ");
mem_add[k]=s4[1];
String[] arr = Integer.parseInt(mem_add[k],16);
binary[k] = Integer.toBinaryString(arr[k]);
}
System.out.println("This is Binary: ");
for(int k=0;k<i;k++)
System.out.println(" "+mem_add[k]);
}

When I compile this program I get this in terminal:-

htb.java:45: incompatible types
found   : int
required: java.lang.String[]
String[] arr = Integer.parseInt(mem_add[k],16);
^
htb.java:46: cannot find symbol
symbol  : method toString(java.lang.String)
location: class java.lang.Integer
binary[k] = Integer.toString(arr[k]);
^
2 errors

Edited 3 Years Ago by Nick Evan: Fixed formatting

incompatible types
found : int
required: java.lang.String[]
String[] arr = Integer.parseInt(mem_add[k],16);

What don't you understand about this message?
the compiler found an int where the datatype should be(required: ) a String

What does parseInt() return? What is to the left of the = ?

Edited 5 Years Ago by NormR1: n/a

This article has been dead for over six months. Start a new discussion instead.