简体   繁体   中英

Does long keep Leading zeros SQLITE Insert

Simple Question just to confirm. A method returns a Long, that long may be made up of leading zeros. What are the rules on this. Are the zeros wiped off when it's passed back or do they stay.

Ahh I realised where this gets more complexed I am currently using this method to add values to a database, it returns a LONG. Android SQLiteDatabase.Insert

So I'm wondering if it returns something with a leading zero what's stopping it being chopped off?

No integral type (or floating point type) preserves leading zeros. In binary, there is no concept of 00 vs 0 (nor in a mathematical sense).

System.out.println(Long.toBinaryString(Long.parseLong("001")));
System.out.println(Long.toBinaryString(Long.parseLong("1")));

Is just going to display 1 for both.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM