Entweder mit bitweisen Operatoren (&):
Code:
String res;
byte bDatum = (byte) 9472;
byte bMontag = 100000000;
byte bDienstag = 1000000000;
etc.
if ((bDatum & bMontag) == bMontag) res += "Montag";
etc.
oder mit modulo (%) was auch relativ einfach wäre:
Code:
int datum=9472;
int temp = datum;
String res;
if ((temp / 16384) == 1) res = "Sonntag";
temp %= 16384;
if ((temp / 8192) == 1) res += "Samstag";
temp %= 8192;
etc.
Es müsste auch möglich sein mit "shift-rechts" (>>) etwas zu basteln (der >> Operator (a >> b) verschiebt ein Bitmuster a um b Stellen nach rechts, entspricht also Einer Division durch 2^b).
Code sollte funktionieren, muß aber nicht..
jak
<edit>Zu langsam...</edit>
____________________________________
Join the DNRC |
Godwin\'s Law (thx@stona)
Documentation is like sex: If it\'s good, it\'s very, very good. If it\'s bad, it\'s better than nothing.
\"In theory, theory and practice are the same. In practice, they are not\" (Lawrence Berra)