Browsing 7239 questions and answers with Jon Skeet
You're replacing the BOM with U+0000, rather than with an empty string. You should replace the BOM with the empty string, e.g. out.write(l.replace("\uFEFF", "") + "\n"); more 11/10/2014 3:52:22 PM
I need to convert a UInt32 type to a float without having it rounded. That can't be done. There are 232 possible uint values. There are fewer than 232 float values (there are 232 bit patterns, but that includes various NaN values).... more 11/10/2014 3:16:08 PM
What you're seeing is two different ways of encoding the same text in UTF-7. Your original text is: @7y6$Hev&(dr!nU^pPĀ£$Tg:~ The ASCII version of bytes2 is +AEA-7y6+ACQ-Hev+ACY-(dr+ACE-nU+AF4-pP+AKMAJA-Tg:+AH4- In other words,... more 11/10/2014 12:47:46 PM
This is your most immediate problem: byte pass[] = md.digest(); System.out.println(pass.toString()); You're not returning the hash of the string. You're returning the result of calling toString() on a byte[]. Arrays in Java don't... more 11/10/2014 6:59:51 AM
You can use Class<?> as the type argument for the second list - and then use Class.isInstance to perform the check for "instancehood": List<Class<?>> classes = new... more 11/9/2014 9:05:44 AM
It should be changed to an interface in Java 8 correct? Not unless you want to break all backwards compatibility, no. If you changed it to an interface, then anything written as: public class Foo extends Observable would be broken.... more 11/9/2014 8:53:43 AM
Specifically, how do I generate dynamic identifiers on each iteration? You don't. Instead, you realize that you've actually got a collection of arrays. For example, you could have: int[][] rows = new... more 11/7/2014 9:10:32 PM
In line 2 public final int a the JVM will assign a default value of 0 to a That's what the JVM does. That's not what the compiler does - it's not an assignment within the source code. It's just the value the variable has before it's... more 11/7/2014 6:53:31 PM
The semi-colon isn't a line terminator... it's a statement terminator. There's a semi-colon at the end of every expression statement and declaration statement. (if, for etc statements aren't expression or declaration statements.) So for... more 11/7/2014 2:31:31 PM
To use a collection initializer, your class has to: Implement IEnumerable Implement appropriate Add methods For example: class A : IEnumerable { private List<int> _evenList = new List<int>(); private... more 11/7/2014 1:06:54 PM