?
Solved

Alternative for RemoteValue.class in rt.jar of jre1.1.6

Posted on 1998-10-29
2
Medium Priority
?
421 Views
Last Modified: 2008-02-01
We used the remoteValue class file in our appln for conerting from & to Hex values. But when the appln is run using rt.jar it says classDefNotfound error for this class.
Is there an alternate class file in rt.jar which could be used for similar purposes.
0
Comment
Question by:vram
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
shchuka earned 100 total points
ID: 1226672
What are you converting to and from Hex values?  Why can't you simply write two short static methods to do the conversion?  Below are the methods:

//--------This one will convert a long to a hex-----------
public static String longToHex(long num) {
    String[] digs = {"0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"};
    String res = new String();

    while(num > 0) {
        res = digs[(int)(num % 16)] + res;
        num /= 16;
    }

    return res;
}

//--------This one will convert a hex to a long-----------
public static hexToLong(String hex) throws NumberFormatException {
    long res = 0;
    long dd = 0;
    String tmp = hex.toUpperCase();

    for(int i=0; i<tmp.length; i++) {
        long dig = (long)tmp.charAt(i);
        if(dig >= 65 && dig <= 70)
            dig -= 55;
        else if(dig >=48 && dig <= 57)
            dig -=48;
        else
            throw new NumberFormatException("Invalid hex number: " + hex);
        res = res * 16 + dig;
    }

    return res;
}

0
 
LVL 4

Expert Comment

by:evijay
ID: 1226673
Why cant you use the methods parseLong in java.lang.Long class

parseLong

 public static long parseLong(String s,
                              int radix) throws NumberFormatException

    Parses the string argument as a signed long in the radix specified by the second argument. The characters in the string must all be
    digits of the specified radix (as determined by whether Character.digit returns a nonnegative value), except that the first
    character may be an ASCII minus sign '-' to indicate a negative value. The resulting long value is returned.

    Parameters:
        s - the String containing the long.
        radix - the radix to be used.
    Returns:
        the long represented by the string argument in the specified radix.
    Throws: NumberFormatException
        if the string does not contain a parsable integer.
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month11 days, 9 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question