| Author | 
		Message | 
	
		 
		Naveg
 
 
 
    
		 | 
		
		
			
				  Posted: Fri Sep 15, 2006 11:22 pm    Post subject: Method for breaking a number into its digits  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| Does java have a method that will do this? I can easily code this myself, but I was wondering if it was already a part of the java library. Essentially you pass a number to the method and it returns an array of ints consisting of the individual digits. | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	
	 
		  | 
	
				 
		wtd
 
 
 
    
		 | 
		
		
			
				  Posted: Sat Sep 16, 2006 8:24 am    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| I don't believe this is a part of the library. | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		r.3volved
 
 
 
    
		 | 
		
		
			
				  Posted: Sat Sep 16, 2006 11:13 am    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				no it doesn't
 
this was talked about just the other day here in another thread...
 
 
use modulus to pick out each integer | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		Naveg
 
 
 
    
		 | 
		
		
			
				  Posted: Sat Sep 16, 2006 5:14 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| yea, i know how to do it - its really easy. Its just that i need to work with digits in many of of my programs, so it would be nice if it were a part of the library. | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		r.3volved
 
 
 
    
		 | 
		
		
			
				  Posted: Sat Sep 16, 2006 5:56 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				just make yourself an extended class and keep it around to include where you need it...
 
 
thats what oop is all about | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		bugzpodder
 
  
 
    
		 | 
		
		
			
				  Posted: Sat Sep 16, 2006 8:08 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| Integer.parseInt(myInteger).charAt(i) | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		bugzpodder
 
  
 
    
		 | 
		
		
			
				  Posted: Sat Sep 16, 2006 8:09 pm    Post subject: (No subject)  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| return (myInteger/Math.pow(10,i))%10 | 
			 
			
				 | 
			 
		  | 
	
	 
		 | 
		
		 | 
	
	
 
		  | 
	
				 
		 |