Take the 2-minute tour ×  I need to return 2 values from a
method. My approach is as follows:    1. create an inner class
with 2 fields that will be used to keep those 2 values   2. put
the method inside that class   3. instantiate the class and call
the method.  The only thing that will be changed in the method
is that in the end it will assign those 2 values to the fields
of the instance. Then I can address those values by referencing
to the fields of that object.  Is it a good design and why?
share|improve this question Another option (probably a bad one):
see BitInteger[]
java.math.BigInteger.divideAndRemainder(BitInteger val). It
returns 2 integers as its return values in an array. – 
earlNameless Oct 1 '12 at 14:30 What type are the two values you
want to return ? –  user61852 Oct 1 '12 at 15:18 Possible
duplicate - stackoverflow.com/questions/12668186/… . – 
m3th0dman Oct 1 '12 at 15:31 add comment  5 Answers  It seems
that this class is taking responsibility away from another
class, and this makes me